Bug 142679 - Edit mode should use a transparent background if the cell has a background image
Summary: Edit mode should use a transparent background if the cell has a background image
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Enhancements
  Show dependency treegraph
 
Reported: 2021-06-05 23:44 UTC by Michael
Modified: 2024-01-05 09:31 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Image of the Calc page with a background image of tabular data. (24.84 KB, image/jpeg)
2021-06-05 23:48 UTC, Michael
Details
Background image via page style (23.31 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-05-16 08:53 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2021-06-05 23:44:20 UTC
Description:
I can change the cell background that appears when I'm entering data by setting:

Tools - LibreOffice - Application Colors - Document Background - Green

We don't want the cell color to be green or any other solid color, we want to see the image under the cell while we type. For this example, I set the Document Background to Green. In the case shown, we can't tell what the value on the image is until we finish entering the data. If we make a mistake, we have to go back and correct the value. If we could see the image as we type, we would be less likely to make an error.

Steps to Reproduce:
1. Have a background image of tabular data
2. Start entering the data in a cell.

Actual Results:
The cell turns a solid color, obscuring the image underneath

Expected Results:
Requested results: the image remains visible in the cell as you type


Reproducible: Always


User Profile Reset: No



Additional Info:
See my question here which has shows an image:

https://ask.libreoffice.org/en/question/312667/when-entering-data-can-the-cell-background-be-transparent/
Comment 1 Michael 2021-06-05 23:48:43 UTC
Created attachment 172651 [details]
Image of the Calc page with a background image of tabular data.
Comment 2 Eike Rathke 2021-06-07 10:46:54 UTC
If the cell background is transparent then the document background colour is taken for visibility. That could be made an option.
Comment 3 Heiko Tietze 2023-05-16 08:44:17 UTC
I assume you do Insert > Image and Format > Arrange > To Background to make it appear behind the editable cells (with access later via the Navigator). Whether the document background is the automatic default or any user defined color does not affect the transparency (or rather opacity), but the goal is to show the background anyway.

I would prefer a different workflow with Format > Page Style and a background image. This image is currently only shown in the preview but I could imagine to have it also in edit mode - users who prefer the current behavior could use a background color for cells. Either changing the page style or an option to not print the background could be handy for printing.

Using Tools - LibreOffice - Application Colors - Document Background has the disadvantage to be also effective in other modules like Writer.
Comment 4 Heiko Tietze 2023-05-16 08:53:52 UTC
Created attachment 187320 [details]
Background image via page style

Example showing also some other issues: a) to cover the background image cells with content need some background color (could be done automatically with a macro), b) empty cells are not added to the printout and the background image is cut-off (could be solved by explicitly setting a grid color).
Comment 5 Michael 2023-05-20 18:45:47 UTC
(In reply to Heiko Tietze from comment #3)
> I assume you do Insert > Image and Format > Arrange > To Background to make
> it appear behind the editable cells (with access later via the Navigator).
> Whether the document background is the automatic default or any user defined
> color does not affect the transparency (or rather opacity), but the goal is
> to show the background anyway.
> 
> I would prefer a different workflow with Format > Page Style and a
> background image. This image is currently only shown in the preview but I
> could imagine to have it also in edit mode - users who prefer the current
> behavior could use a background color for cells. Either changing the page
> style or an option to not print the background could be handy for printing.
> 
> Using Tools - LibreOffice - Application Colors - Document Background has the
> disadvantage to be also effective in other modules like Writer.

This is a chunk of our macro that loads the image.

	' Get graphic using Dispatcher; code from macro recorder
	' Direct URL retrieval methods do not fail gracefully
	args1(0).Name = "FileName"
	args1(0).Value = imgURL
	args1(1).Name = "FilterName"
	args1(1).Value = "<All formats>"
	args1(2).Name = "AsLink"
	args1(2).Value = false
	dispatcher.executeDispatch(document, ".uno:InsertGraphic", "", 0, args1())

	' Get image as object for manipulation	
	imgCount = DrawPage.Count
	flagFound = False
	' Search for proper image
	For x = 0 To imgCount-1
	    objImage = DrawPage.getByIndex(x)
	    If objImage.Name = "Image 1" Then
			' Image found

		    objSize = objImage.getSize
		    newWidth = (objSize.width)*imgScale
		    newHeight = (objSize.height)*imgScale
		    ' Set new dimensions
		    objSize.width = newWidth
		    objSize.height = newHeight
		    objImage.setsize(objSize)
		    
		    ' Image enhancements

			If EnhanceFlag = "Y" Then
			
				If Brightness <> 0 Then objImage.AdjustLuminance = Brightness
				If Contrast <> 0 Then objImage.AdjustContrast = Contrast
				If Gamma <> 0 Then objImage.Gamma = Gamma
				If ColorMode = "C" Then
					objImage.GraphicColorMode = com.sun.star.drawing.ColorMode.STANDARD
				End If
				If ColorMode = "G" Then
					objImage.GraphicColorMode = com.sun.star.drawing.ColorMode.GREYS
				End If			
		    
		    End If
			' Get crop properties and validate
			Cell = Doc.Sheets.GetByName("Setup").getCellRangeByName("Crop")
			CropFlag = Cell.String
			CropFlag = UCase(Left(CropFlag, 1))
			If (CropFlag <> "Y") and (CropFlag <> "N")  Then
				GoToNamedCell("Setup", "Crop", 1, 1)
				MsgBox "Enter Yes or No in the Crop Image Cell to indicate" + CHR$(10) +_
						"whether you want the image cropped."
				Exit sub
			End If
			
			If (CropFlag = "Y") Then
				objImage = Crop_Image(ObjImage, imgScale)
			End If
		    
			' Image found - background LayerID = 1, foreground LayerID = 0
			objImage.LayerID = 1
			RotateImage
			flagFound = True
			Exit For
	    End If
	Next x
Comment 6 Heiko Tietze 2023-05-22 07:22:00 UTC
Whether you insert an image (manually or per macro) or use the page style (wouldn't be shown yet) or cell style (has no image option yet), if the cell has a background image the edit mode should use a transparent background.

Easy hackable, Eike?
Comment 7 Eike Rathke 2023-05-22 09:54:08 UTC
No.