9

Due, I think, to some clumsiness with the mouse, a calc window got reduced to an invisible size. This got stored as the default for the next opening of a file. Now any calc file I open comes up invisible and I cannot do anything with it. Where can I find where this format is stored so as to delete it and get back to normal?

Ubuntu 19.04 ibreoffice-calc 1:6.2.5-0ubuntu0.19.04.1 X and Gnome

DK Bose
  • 42,548
  • 23
  • 127
  • 221
  • https://askubuntu.com/questions/107951/how-to-set-a-specific-window-size-and-placement-for-all-windows-that-open-to-def – graham Jul 19 '19 at 06:05
  • You should mention your distro, its version, your desktop environment and window manager, and the version of LibreOffice. – DK Bose Jul 19 '19 at 08:06
  • Latest upgrade of Ubuntu.

    libreoffice-calc 1:6.2.5-0ubuntu0.19.04.1 amd64

    Using X and Gnome

    Somewhere in the confusing mass of .* directories in my home directory must be stored the parameters of the last calc window used. But where? Does that depend on any of those things you asked for?

    – Oliver Elphick Jul 19 '19 at 08:20
  • I managed to find the window by removing the background picture and looking against a plain background, and I could then resize it.

    However I would still like to know where all this data is stored. Looking for recently changed files suggests .config/libreoffice/4/user/registrymodifications.xcu and .pack. But where is the documentation?

    – Oliver Elphick Jul 19 '19 at 08:38
  • I'd guess that it's not calc, but the window manager which stores the last window size per application. – danzel Jul 19 '19 at 08:43
  • @danzel, I tried a small experiment: I opened Mousepad, a small text editor, resized its window and closed it. I then looked in my home folder for recently changed files. There were two: ~/.config/dconf/user and ~/.config/Mousepad/accels.scm. The latter wasn't not relevant. The former stored the window size of Mousepad when I closed it. But it didn't store the screen placement. Maybe that part is handled by the wm. In my case it's kwin. Looking at kwin's options, it's set to smart placement, whatever that is. So it seems there are two factors: size and placement. – DK Bose Jul 19 '19 at 10:34
  • On doing the same with LibreOffice, I see the same as the OP: ~/.config/libreoffice/4/user/registrymodifications.xcu, no entry in dconf/user for libreoffice. – DK Bose Jul 19 '19 at 10:39
  • I don't think one can suddenly reduce a window to invisible size by some clumsiness. This is a bug, still happening in 20.10 and is very frustrating. Seems the default size on my external screen is 0 and this happens when I drag a window away from maximized. Alt-Space to the rescue. – FNia Feb 09 '22 at 08:20

4 Answers4

6

In addition to DK Bose's answer, in case you want to manipulate the file manually:

You are right, window size (and position) are stored in ~/.config/libreoffice/4/user/registrymodifications.xcu when you close the last window of e.g. Calc.

The prop is called ooSetupFactoryWindowAttributes, and there is one for each document type (Drawing, Presentation, Spreadsheet, Text) (and one for the StartModule).

For example, the following line describes the WindowAttributes of Impress:

<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.presentation.PresentationDocument']"><prop oor:name="ooSetupFactoryWindowAttributes" oor:op="fuse"><value>56,29,1864,1051;53;56,29,1864,1051;</value></prop></item>

The value of that prop can be interpreted as follows:

x-pos,y-pos,width,height;window-state;maximized-x-pos,maximized-y-pos,maximized-width,maximized-height;

Position and size are pixels, window-state is the decimal representation of a 7-bit bitmask, where, according to the vcl source code (API documentation available here):

Normal         = 0x0001,
Minimized      = 0x0002,
Maximized      = 0x0004,
Rollup         = 0x0008,
MaximizedHorz  = 0x0010,
MaximizedVert  = 0x0020,
FullScreen     = 0x0040,

The 53 in the example above means:

53(dec) == 110101(bin) == Normal|Maximized|MaximizedHorz|MaximizedVert

You can change those values manually, but probably not all of them will be respected. On my Kubuntu 18.04, only width,height, Minimized, Maximized[Horz|Vert] and Rollup have any effect.

danzel
  • 6,044
  • nothing else worked for me I have 2 screens setup that have different resolutions and the window kept opening on the lower res screen sized for the higher res screen. I simply edited the maximized values to 640 and 480 with gedit (any text editor should do) which made the window small enough to move and resize at will. LibreOffice 6.0.7.3 – Elder Geek Dec 13 '23 at 16:44
4

Just had this problem, found a simple solution here.

While Calc is your current program, use Alt + Space to force the window to maximize again, or resize to wherever you want it.

ThunderBird
  • 1,955
Alex
  • 41
2

Default window position and size for Calc, Writer and other modules are stored in LibreOffice configuration. You can reset the defaults from the Expert Configuration window.

To open it, go to menu Tools > Options > LibreOffice > Advanced > Open Expert Configuration, then search for FactoryWindowAttributes (search is not case sensitive).

This will list several items, one for each LibreOffice module, such as Writer (TextDocument) and Calc (SpreadsheetDocument). Names are self explanatory.

Double click on the one related to Calc, and reset it, deleting the current value, and click OK. Then click OK on the other configuration windows to save your preferences.

Expert configuration window screenshot

gerlos
  • 2,774
1

LibreOffice stores information about window size and placement in ~/.config/libreoffice/4/user/registrymodifications.xcu which is an xml file.

The registrymodifications.xcu file is not meant to be accessed by the average user. However, if you go into Tools > Options > Advanced, you'll see a button labelled Open Expert Configuration. Clicking this button opens a window containing the contents of registrymodifications.xcu and maybe other stuff as well. You can identify the line storing your last used window size and position if you know what to look for.

Because I'm not an expert, I took another route. I used xwininfo to check a LibreOffice Writer window:

  Absolute upper-left X:  556
  Absolute upper-left Y:  337
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 747
  Height: 353
  Depth: 24
  Visual: 0x10e
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x5400002 (not installed)                        
  Bit Gravity State: NorthWestGravity                        
  Window Gravity State: NorthWestGravity                     
  Backing Store State: NotUseful                             
  Save Under State: no                                       
  Map State: IsViewable                                      
  Override Redirect State: no                                
  Corners:  +556+337  -63+337  -63-78  +556-78               
  -geometry 747x353-63-78                                    

Then, I opened a copy of ~/.config/libreoffice/4/user/registrymodifications.xcu and searched for lines containing 747 (based on the -geometry). That got me just the one line:

<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.text.TextDocument']"><prop oor:name="ooSetupFactoryWindowAttributes" oor:op="fuse"><value>556,337,747,353;1;0,0,0,0;</value></prop></item>

Now, I knew what to search for in the Expert Configuration window I mentioned earlier. That window has a Help button offering some documentation in case you want to look deeper into matters.

Expert Configuration

DK Bose
  • 42,548
  • 23
  • 127
  • 221