LibreOffice Module sw (master)  1
frmpage.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <com/sun/star/embed/Aspects.hpp>
21 #include <com/sun/star/embed/EmbedMisc.hpp>
22 #include <com/sun/star/embed/XEmbeddedObject.hpp>
23 
24 #include <cmdid.h>
25 #include <hintids.hxx>
26 #include <bitmaps.hlst>
27 #include <o3tl/safeint.hxx>
28 #include <vcl/mnemonic.hxx>
29 #include <svl/stritem.hxx>
30 #include <sfx2/htmlmode.hxx>
31 #include <editeng/sizeitem.hxx>
32 #include <editeng/opaqitem.hxx>
33 #include <editeng/protitem.hxx>
34 #include <editeng/prntitem.hxx>
35 #include <editeng/brushitem.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <editeng/frmdiritem.hxx>
40 #include <svx/sdangitm.hxx>
41 #include <comphelper/classids.hxx>
42 #include <tools/globname.hxx>
43 #include <tools/urlobj.hxx>
44 #include <fmturl.hxx>
45 #include <fmteiro.hxx>
46 #include <fmtcnct.hxx>
47 #include <fmtsrnd.hxx>
48 #include <view.hxx>
49 #include <wrtsh.hxx>
50 #include <swmodule.hxx>
51 #include <uitool.hxx>
52 #include <docsh.hxx>
53 #include <viewopt.hxx>
54 #include <frmdlg.hxx>
55 #include <frmmgr.hxx>
56 #include <frmpage.hxx>
57 #include <colmgr.hxx>
58 #include <grfatr.hxx>
59 #include <fmtfollowtextflow.hxx>
60 #include <svx/sdtaitm.hxx>
61 #include <sal/macros.h>
62 #include <osl/diagnose.h>
63 
64 #include <strings.hrc>
65 #include <svx/strings.hrc>
66 #include <svx/dialmgr.hxx>
67 #include <svx/graphichelper.hxx>
68 #include <sfx2/filedlghelper.hxx>
69 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
70 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
71 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
72 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
73 #include <vcl/graphicfilter.hxx>
74 #include <svtools/embedhlp.hxx>
75 #include <comphelper/lok.hxx>
76 #include <memory>
77 
78 using namespace ::com::sun::star;
79 using namespace ::sfx2;
80 
81 #define SwFPos SvxSwFramePosString
82 
83 namespace {
84 
85 struct StringIdPair_Impl
86 {
89 };
90 
91 }
92 
93 #define MAX_PERCENT_WIDTH 254
94 #define MAX_PERCENT_HEIGHT 254
95 
96 namespace {
97 
98 enum class LB {
99  NONE = 0x00000000L,
100  Frame = 0x00000001L, // text region of the paragraph
101  PrintArea = 0x00000002L, // text region of the paragraph + indentions
102  VertFrame = 0x00000004L, // vertical text region of the paragraph
103  VertPrintArea = 0x00000008L, // vertical text region of the paragraph + indentions
104  RelFrameLeft = 0x00000010L, // left paragraph edge
105  RelFrameRight = 0x00000020L, // right paragraph edge
106 
107  RelPageLeft = 0x00000040L, // left page edge
108  RelPageRight = 0x00000080L, // right page edge
109  RelPageFrame = 0x00000100L, // whole page
110  RelPagePrintArea = 0x00000200L, // text region of the page
111 
112  FlyRelPageLeft = 0x00000400L, // left frame edge
113  FlyRelPageRight = 0x00000800L, // right frame edge
114  FlyRelPageFrame = 0x00001000L, // whole frame
115  FlyRelPagePrintArea = 0x00002000L, // inside of the frame
116 
117  RelBase = 0x00010000L, // character alignment Base
118  RelChar = 0x00020000L, // character alignment Character
119  RelRow = 0x00040000L, // character alignment Row
120 
121  FlyVertFrame = 0x00100000L, // vertical entire frame
122  FlyVertPrintArea = 0x00200000L, // vertical frame text area
123 
124  VertLine = 0x00400000L, // vertical text line
125 };
126 
127 }
128 
129 namespace o3tl {
130  template<> struct typed_flags<LB> : is_typed_flags<LB, 0x00773fffL> {};
131 }
132 
133 namespace {
134 
135 struct RelationMap
136 {
138  SvxSwFramePosString::StringId eMirrorStrId;
139  LB nLBRelation;
140  sal_Int16 nRelation;
141 };
142 
143 }
144 
145 struct FrameMap
146 {
149  sal_Int16 nAlign;
151 };
152 
153 
154 RelationMap const aRelationMap[] =
155 {
156  {SwFPos::FRAME, SwFPos::FRAME, LB::Frame, text::RelOrientation::FRAME},
157  {SwFPos::PRTAREA, SwFPos::PRTAREA, LB::PrintArea, text::RelOrientation::PRINT_AREA},
158  {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB::RelPageLeft, text::RelOrientation::PAGE_LEFT},
159  {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB::RelPageRight, text::RelOrientation::PAGE_RIGHT},
160  {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB::RelFrameLeft, text::RelOrientation::FRAME_LEFT},
161  {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB::RelFrameRight, text::RelOrientation::FRAME_RIGHT},
162  {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB::RelPageFrame, text::RelOrientation::PAGE_FRAME},
163  {SwFPos::REL_PG_PRTAREA, SwFPos::REL_PG_PRTAREA, LB::RelPagePrintArea, text::RelOrientation::PAGE_PRINT_AREA},
164  {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB::RelChar, text::RelOrientation::CHAR},
165 
166  {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB::FlyRelPageLeft, text::RelOrientation::PAGE_LEFT},
167  {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB::FlyRelPageRight, text::RelOrientation::PAGE_RIGHT},
168  {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB::FlyRelPageFrame, text::RelOrientation::PAGE_FRAME},
169  {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB::FlyRelPagePrintArea, text::RelOrientation::PAGE_PRINT_AREA},
170 
171  {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB::VertFrame, text::RelOrientation::FRAME},
172  {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB::VertPrintArea, text::RelOrientation::PRINT_AREA},
173 
174  {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB::FlyVertFrame, text::RelOrientation::FRAME},
175  {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB::FlyVertPrintArea, text::RelOrientation::PRINT_AREA},
176 
177  {SwFPos::REL_LINE, SwFPos::REL_LINE, LB::VertLine, text::RelOrientation::TEXT_LINE}
178 };
179 
180 RelationMap const aAsCharRelationMap[] =
181 {
182  {SwFPos::REL_BASE, SwFPos::REL_BASE, LB::RelBase, text::RelOrientation::FRAME},
183  {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB::RelChar, text::RelOrientation::FRAME},
184  {SwFPos::REL_ROW, SwFPos::REL_ROW, LB::RelRow, text::RelOrientation::FRAME}
185 };
186 
187 // site anchored
188 constexpr auto HORI_PAGE_REL = LB::RelPageFrame | LB::RelPagePrintArea | LB::RelPageLeft |
189  LB::RelPageRight;
190 
192 {
193  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PAGE_REL},
194  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PAGE_REL},
195  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PAGE_REL},
196  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PAGE_REL}
197 };
198 
200 {
201  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::RelPageFrame}
202 };
203 
204 #define VERT_PAGE_REL (LB::RelPageFrame|LB::RelPagePrintArea)
205 
207 {
208  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PAGE_REL},
209  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PAGE_REL},
210  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PAGE_REL},
211  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PAGE_REL}
212 };
213 
215 {
216  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB::RelPageFrame}
217 };
218 
219 // frame anchored
220 constexpr auto HORI_FRAME_REL = LB::FlyRelPageFrame | LB::FlyRelPagePrintArea |
221  LB::FlyRelPageLeft | LB::FlyRelPageRight;
222 
224 {
225  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_FRAME_REL},
226  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_FRAME_REL},
227  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_FRAME_REL},
228  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_FRAME_REL}
229 };
230 
232 {
233  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB::FlyRelPageFrame},
234  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::FlyRelPageFrame}
235 };
236 
237 // own vertical alignment map for objects anchored to frame
238 #define VERT_FRAME_REL (LB::FlyVertFrame|LB::FlyVertPrintArea)
239 
241 {
242  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_FRAME_REL},
243  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_FRAME_REL},
244  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_FRAME_REL},
245  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_FRAME_REL}
246 };
247 
249 {
250  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::FlyVertFrame},
251  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB::FlyVertFrame}
252 };
253 
254 // paragraph anchored
255 constexpr auto HORI_PARA_REL = LB::Frame | LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
256  LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
257  LB::RelFrameRight;
258 
260 {
261  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PARA_REL},
262  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PARA_REL},
263  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PARA_REL},
264  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PARA_REL}
265 };
266 
267 #define HTML_HORI_PARA_REL (LB::Frame|LB::PrintArea)
268 
270 {
271  {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
272  {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
273 };
274 
276 {
277  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
278  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
279 };
280 
281 // allow vertical alignment at page areas
282 constexpr auto VERT_PARA_REL = LB::VertFrame | LB::VertPrintArea |
283  LB::RelPageFrame | LB::RelPagePrintArea;
284 
286 {
287  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PARA_REL},
288  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PARA_REL},
289  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PARA_REL},
290  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PARA_REL}
291 };
292 
294 {
295  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::VertPrintArea}
296 };
297 
298 // anchored relative to the character
299 constexpr auto HORI_CHAR_REL = LB::Frame|LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
300  LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
301  LB::RelFrameRight | LB::RelChar;
302 
304 {
305  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_CHAR_REL},
306  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_CHAR_REL},
307  {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_CHAR_REL},
308  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_CHAR_REL}
309 };
310 
311 #define HTML_HORI_CHAR_REL (LB::Frame|LB::PrintArea|LB::RelChar)
312 
314 {
315  {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_CHAR_REL},
316  {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_CHAR_REL}
317 };
318 
320 {
321  {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB::PrintArea|LB::RelChar},
322  {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, LB::PrintArea},
323  {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::RelPageFrame}
324 };
325 
326 // allow vertical alignment at page areas
327 constexpr auto VERT_CHAR_REL = LB::VertFrame | LB::VertPrintArea |
328  LB::RelPageFrame | LB::RelPagePrintArea;
329 
331 {
332  // introduce mappings for new vertical alignment at top of line <LB::VertLine>
333  // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
334  // Note: Because of these adjustments the map becomes ambiguous in its values
335  // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
336  // in the methods <SwFramePage::FillRelLB(..)>, <SwFramePage::GetAlignment(..)>
337  // and <SwFramePage::FillPosLB(..)>
338  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_CHAR_REL|LB::RelChar},
339  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_CHAR_REL|LB::RelChar},
340  {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar},
341  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_CHAR_REL|LB::RelChar},
342  {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_CHAR_REL},
343  {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB::RelChar|LB::VertLine},
344  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::VertLine},
345  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::VertLine},
346  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::VertLine}
347 };
348 
350 {
351  {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar}
352 };
353 
355 {
356  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelChar},
357  {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar}
358 };
359 
360 // anchored as character
362 {
363  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelBase},
364  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, LB::RelBase},
365  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB::RelBase},
366 
367  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB::RelChar},
368  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::CHAR_BOTTOM, LB::RelChar},
369  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CHAR_CENTER, LB::RelChar},
370 
371  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::RelRow},
372  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::RelRow},
373  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::RelRow},
374 
375  {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB::RelBase}
376 };
377 
379 {
380  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelBase},
381  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB::RelBase},
382 
383  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB::RelChar},
384 
385  {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::RelRow},
386  {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::RelRow},
387  {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::RelRow}
388 };
389 
393  RES_COL, RES_COL,
395 >);
402 >);
403 
404 static size_t lcl_GetFrameMapCount( const FrameMap* pMap)
405 {
406  if ( pMap )
407  {
408  if( pMap == aVParaHtmlMap)
409  return SAL_N_ELEMENTS(aVParaHtmlMap);
410  if( pMap == aVAsCharHtmlMap)
411  return SAL_N_ELEMENTS(aVAsCharHtmlMap);
412  if( pMap == aHParaHtmlMap)
413  return SAL_N_ELEMENTS(aHParaHtmlMap);
414  if( pMap == aHParaHtmlAbsMap)
415  return SAL_N_ELEMENTS(aHParaHtmlAbsMap);
416  if ( pMap == aVPageMap )
417  return SAL_N_ELEMENTS(aVPageMap);
418  if ( pMap == aVPageHtmlMap )
419  return SAL_N_ELEMENTS(aVPageHtmlMap);
420  if ( pMap == aVAsCharMap )
421  return SAL_N_ELEMENTS(aVAsCharMap);
422  if ( pMap == aVParaMap )
423  return SAL_N_ELEMENTS(aVParaMap);
424  if ( pMap == aHParaMap )
425  return SAL_N_ELEMENTS(aHParaMap);
426  if ( pMap == aHFrameMap )
427  return SAL_N_ELEMENTS(aHFrameMap);
428  if ( pMap == aVFrameMap )
429  return SAL_N_ELEMENTS(aVFrameMap);
430  if ( pMap == aHCharMap )
431  return SAL_N_ELEMENTS(aHCharMap);
432  if ( pMap == aHCharHtmlMap )
433  return SAL_N_ELEMENTS(aHCharHtmlMap);
434  if ( pMap == aHCharHtmlAbsMap )
435  return SAL_N_ELEMENTS(aHCharHtmlAbsMap);
436  if ( pMap == aVCharMap )
437  return SAL_N_ELEMENTS(aVCharMap);
438  if ( pMap == aVCharHtmlMap )
439  return SAL_N_ELEMENTS(aVCharHtmlMap);
440  if ( pMap == aVCharHtmlAbsMap )
441  return SAL_N_ELEMENTS(aVCharHtmlAbsMap);
442  if ( pMap == aHPageHtmlMap )
443  return SAL_N_ELEMENTS(aHPageHtmlMap);
444  if ( pMap == aHFlyHtmlMap )
445  return SAL_N_ELEMENTS(aHFlyHtmlMap);
446  if ( pMap == aVFlyHtmlMap )
447  return SAL_N_ELEMENTS(aVFlyHtmlMap);
448  return SAL_N_ELEMENTS(aHPageMap);
449  }
450  return 0;
451 }
452 
454  const std::vector< OUString >& rPrev, const std::vector< OUString >& rThis,
455  const std::vector< OUString >& rNext, const std::vector< OUString >& rRemain)
456 {
457  for(const auto& rItem : rPrev)
458  rBox.append_text(rItem);
459  for(const auto& rItem : rThis)
460  rBox.append_text(rItem);
461  for(const auto& rItem : rNext)
462  rBox.append_text(rItem);
463  rBox.append_separator("");
464  //now insert all strings sorted
465  const auto nStartPos = rBox.get_count();
466 
467  for(const auto& rItem : rPrev)
468  ::InsertStringSorted("", rItem, rBox, nStartPos );
469  for(const auto& rItem : rThis)
470  ::InsertStringSorted("", rItem, rBox, nStartPos );
471  for(const auto& rItem : rNext)
472  ::InsertStringSorted("", rItem, rBox, nStartPos );
473  for(const auto& rItem : rRemain)
474  ::InsertStringSorted("", rItem, rBox, nStartPos );
475 }
476 
477 // --> OD 2009-08-31 #mongolianlayout#
478 // add input parameter
479 static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, bool bVertical, bool bVerticalL2R, bool bRTL)
480 {
481  //special handling of STR_FROMLEFT
482  if ( SwFPos::FROMLEFT == eStringId )
483  {
484  eStringId = bVertical
485  ? ( bRTL
486  ? SwFPos::FROMBOTTOM
487  : SwFPos::FROMTOP )
488  : ( bRTL
489  ? SwFPos::FROMRIGHT
490  : SwFPos::FROMLEFT );
491  return eStringId;
492  }
493  // --> OD 2009-08-31 #mongolianlayout#
494  // special handling of STR_FROMTOP in case of mongolianlayout (vertical left-to-right)
495  if ( SwFPos::FROMTOP == eStringId &&
496  bVertical && bVerticalL2R )
497  {
498  eStringId = SwFPos::FROMLEFT;
499  return eStringId;
500  }
501  if ( bVertical )
502  {
503  //exchange horizontal strings with vertical strings and vice versa
504  static const StringIdPair_Impl aHoriIds[] =
505  {
506  {SwFPos::LEFT, SwFPos::TOP},
507  {SwFPos::RIGHT, SwFPos::BOTTOM},
508  {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT},
509  {SwFPos::FROMTOP, SwFPos::FROMRIGHT},
510  {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP},
511  {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} ,
512  {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP},
513  {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM}
514  };
515  static const StringIdPair_Impl aVertIds[] =
516  {
517  {SwFPos::TOP, SwFPos::RIGHT},
518  {SwFPos::BOTTOM, SwFPos::LEFT },
519  {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI},
520  {SwFPos::FROMTOP, SwFPos::FROMRIGHT },
521  {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
522  {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
523  {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
524  {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
525  };
526  // --> OD 2009-08-31 #monglianlayout#
527  static const StringIdPair_Impl aVertL2RIds[] =
528  {
529  {SwFPos::TOP, SwFPos::LEFT },
530  {SwFPos::BOTTOM, SwFPos::RIGHT },
531  {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI },
532  {SwFPos::FROMTOP, SwFPos::FROMLEFT },
533  {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
534  {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
535  {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
536  {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
537  };
538  for(const StringIdPair_Impl & rHoriId : aHoriIds)
539  {
540  if(rHoriId.eHori == eStringId)
541  {
542  eStringId = rHoriId.eVert;
543  return eStringId;
544  }
545  }
546  for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex)
547  {
548  // --> OD 2009-08-31 #mongolianlayout#
549  if ( !bVerticalL2R )
550  {
551  if(aVertIds[nIndex].eHori == eStringId)
552  {
553  eStringId = aVertIds[nIndex].eVert;
554  break;
555  }
556  }
557  else
558  {
559  if(aVertL2RIds[nIndex].eHori == eStringId)
560  {
561  eStringId = aVertL2RIds[nIndex].eVert;
562  break;
563  }
564  }
565  }
566  }
567  return eStringId;
568 }
569 
570 // helper method in order to determine all possible
571 // listbox relations in a relation map for a given relation
572 static LB lcl_GetLBRelationsForRelations( const sal_Int16 _nRel )
573 {
574  LB nLBRelations = LB::NONE;
575 
576  for (RelationMap const & i : aRelationMap)
577  {
578  if ( i.nRelation == _nRel )
579  {
580  nLBRelations |= i.nLBRelation;
581  }
582  }
583 
584  return nLBRelations;
585 }
586 
587 // helper method on order to determine all possible
588 // listbox relations in a relation map for a given string ID
590  const SvxSwFramePosString::StringId _eStrId,
591  const bool _bUseMirrorStr )
592 {
593  LB nLBRelations = LB::NONE;
594 
595  size_t nRelMapSize = lcl_GetFrameMapCount( _pMap );
596  for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
597  {
598  if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) ||
599  ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) )
600  {
601  nLBRelations |= _pMap[nRelMapPos].nLBRelations;
602  }
603  }
604 
605  return nLBRelations;
606 }
607 
608 // standard frame TabPage
609 namespace
610 {
611  void HandleAutoCB(bool _bChecked, weld::Label& _rFT_man, weld::Label& _rFT_auto, weld::MetricSpinButton& _rPF_Edit)
612  {
613  _rFT_man.set_visible( !_bChecked );
614  _rFT_auto.set_visible( _bChecked );
615  OUString accName = _bChecked ? _rFT_auto.get_label() : _rFT_man.get_label();
616  _rPF_Edit.set_accessible_name(accName);
617  }
618 }
619 
621  : SfxTabPage(pPage, pController, "modules/swriter/ui/frmtypepage.ui", "FrameTypePage", &rSet)
622  , m_bAtHorzPosModified(false)
623  , m_bAtVertPosModified(false)
624  , m_bFormat(false)
625  , m_bNew(true)
626  , m_bNoModifyHdl(true)
627  , m_bIsVerticalFrame(false)
628  , m_bIsVerticalL2R(false)
629  , m_bIsInRightToLeft(false)
630  , m_bHtmlMode(false)
631  , m_nHtmlMode(0)
632  , m_nUpperBorder(0)
633  , m_nLowerBorder(0)
634  , m_fWidthHeightRatio(1.0)
635  , mpToCharContentPos(nullptr)
636  , m_nOldH(text::HoriOrientation::CENTER)
637  , m_nOldHRel(text::RelOrientation::FRAME)
638  , m_nOldV(text::VertOrientation::TOP)
639  , m_nOldVRel(text::RelOrientation::PRINT_AREA)
640  , m_pVMap(nullptr)
641  , m_pHMap(nullptr)
642  , m_bAllowVertPositioning( true )
643  , m_bIsMathOLE(false)
644  , m_bIsMathBaselineAlignment(true)
645  , m_xWidthFT(m_xBuilder->weld_label("widthft"))
646  , m_xWidthAutoFT(m_xBuilder->weld_label("autowidthft"))
647  , m_xRelWidthCB(m_xBuilder->weld_check_button("relwidth"))
648  , m_xRelWidthRelationLB(m_xBuilder->weld_combo_box("relwidthrelation"))
649  , m_xAutoWidthCB(m_xBuilder->weld_check_button("autowidth"))
650  , m_xHeightFT(m_xBuilder->weld_label("heightft"))
651  , m_xHeightAutoFT(m_xBuilder->weld_label("autoheightft"))
652  , m_xRelHeightCB(m_xBuilder->weld_check_button("relheight"))
653  , m_xRelHeightRelationLB(m_xBuilder->weld_combo_box("relheightrelation"))
654  , m_xAutoHeightCB(m_xBuilder->weld_check_button("autoheight"))
655  , m_xFixedRatioCB(m_xBuilder->weld_check_button("ratio"))
656  , m_xRealSizeBT(m_xBuilder->weld_button("origsize"))
657  , m_xAnchorFrame(m_xBuilder->weld_widget("anchorframe"))
658  , m_xAnchorAtPageRB(m_xBuilder->weld_radio_button("topage"))
659  , m_xAnchorAtParaRB(m_xBuilder->weld_radio_button("topara"))
660  , m_xAnchorAtCharRB(m_xBuilder->weld_radio_button("tochar"))
661  , m_xAnchorAsCharRB(m_xBuilder->weld_radio_button("aschar"))
662  , m_xAnchorAtFrameRB(m_xBuilder->weld_radio_button("toframe"))
663  , m_xHorizontalFT(m_xBuilder->weld_label("horiposft"))
664  , m_xHorizontalDLB(m_xBuilder->weld_combo_box("horipos"))
665  , m_xAtHorzPosFT(m_xBuilder->weld_label("horibyft"))
666  , m_xAtHorzPosED(m_xBuilder->weld_metric_spin_button("byhori", FieldUnit::CM))
667  , m_xHoriRelationFT(m_xBuilder->weld_label("horitoft"))
668  , m_xHoriRelationLB(m_xBuilder->weld_combo_box("horianchor"))
669  , m_xMirrorPagesCB(m_xBuilder->weld_check_button("mirror"))
670  , m_xVerticalFT(m_xBuilder->weld_label("vertposft"))
671  , m_xVerticalDLB(m_xBuilder->weld_combo_box("vertpos"))
672  , m_xAtVertPosFT(m_xBuilder->weld_label("vertbyft"))
673  , m_xAtVertPosED(m_xBuilder->weld_metric_spin_button("byvert", FieldUnit::CM))
674  , m_xVertRelationFT(m_xBuilder->weld_label("verttoft"))
675  , m_xVertRelationLB(m_xBuilder->weld_combo_box("vertanchor"))
676  , m_xFollowTextFlowCB(m_xBuilder->weld_check_button("followtextflow"))
677  , m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "preview", m_aExampleWN))
678  , m_xWidthED(new SwPercentField(m_xBuilder->weld_metric_spin_button("width", FieldUnit::CM)))
679  , m_xHeightED(new SwPercentField(m_xBuilder->weld_metric_spin_button("height", FieldUnit::CM)))
680 {
681  const auto nWidthRequest = m_xAtHorzPosED->get_preferred_size().Width();
682  m_xAtHorzPosED->set_size_request(nWidthRequest, -1);
683  m_xAtVertPosED->set_size_request(nWidthRequest, -1);
684 
687 
689 
690  Link<weld::MetricSpinButton&,void> aLk3 = LINK(this, SwFramePage, ModifyHdl);
691  m_xWidthED->connect_value_changed( aLk3 );
692  m_xHeightED->connect_value_changed( aLk3 );
693  m_xAtHorzPosED->connect_value_changed( aLk3 );
694  m_xAtVertPosED->connect_value_changed( aLk3 );
695  m_xFollowTextFlowCB->connect_toggled(LINK(this, SwFramePage, RangeModifyClickHdl));
696 
697  Link<weld::Toggleable&,void> aLk2 = LINK(this, SwFramePage, AnchorTypeHdl);
698  m_xAnchorAtPageRB->connect_toggled( aLk2 );
699  m_xAnchorAtParaRB->connect_toggled( aLk2 );
700  m_xAnchorAtCharRB->connect_toggled( aLk2 );
701  m_xAnchorAsCharRB->connect_toggled( aLk2 );
702  m_xAnchorAtFrameRB->connect_toggled( aLk2 );
703 
704  m_xHorizontalDLB->connect_changed(LINK(this, SwFramePage, PosHdl));
705  m_xVerticalDLB->connect_changed(LINK(this, SwFramePage, PosHdl));
706 
707  m_xHoriRelationLB->connect_changed(LINK(this, SwFramePage, RelHdl));
708  m_xVertRelationLB->connect_changed(LINK(this, SwFramePage, RelHdl));
709 
710  m_xMirrorPagesCB->connect_toggled(LINK(this, SwFramePage, MirrorHdl));
711 
712  aLk2 = LINK(this, SwFramePage, RelSizeClickHdl);
713  m_xRelWidthCB->connect_toggled(aLk2);
714  m_xRelHeightCB->connect_toggled(aLk2);
715 
716  m_xAutoWidthCB->connect_toggled(LINK(this, SwFramePage, AutoWidthClickHdl));
717  m_xAutoHeightCB->connect_toggled(LINK(this, SwFramePage, AutoHeightClickHdl));
718 
720  {
721  m_xAnchorAtPageRB->hide();
722  m_xAnchorAtParaRB->hide();
723  m_xAnchorAtFrameRB->hide();
724  }
725 }
726 
728 {
729 }
730 
731 namespace
732 {
733  struct FrameMaps
734  {
735  FrameMap const * pMap;
736  size_t nCount;
737  };
738 }
739 
741 {
742  static FrameMaps const aMaps[] = {
743  { aHPageMap, SAL_N_ELEMENTS(aHPageMap) },
744  { aHPageHtmlMap, SAL_N_ELEMENTS(aHPageHtmlMap) },
745  { aVPageMap, SAL_N_ELEMENTS(aVPageMap) },
746  { aVPageHtmlMap, SAL_N_ELEMENTS(aVPageHtmlMap) },
747  { aHFrameMap, SAL_N_ELEMENTS(aHFrameMap) },
748  { aHFlyHtmlMap, SAL_N_ELEMENTS(aHFlyHtmlMap) },
749  { aVFrameMap, SAL_N_ELEMENTS(aVFrameMap) },
750  { aVFlyHtmlMap, SAL_N_ELEMENTS(aVFlyHtmlMap) },
751  { aHParaMap, SAL_N_ELEMENTS(aHParaMap) },
752  { aHParaHtmlMap, SAL_N_ELEMENTS(aHParaHtmlMap) },
753  { aHParaHtmlAbsMap, SAL_N_ELEMENTS(aHParaHtmlAbsMap) },
754  { aVParaMap, SAL_N_ELEMENTS(aVParaMap) },
755  { aVParaHtmlMap, SAL_N_ELEMENTS(aVParaHtmlMap) },
756  { aHCharMap, SAL_N_ELEMENTS(aHCharMap) },
757  { aHCharHtmlMap, SAL_N_ELEMENTS(aHCharHtmlMap) },
758  { aHCharHtmlAbsMap, SAL_N_ELEMENTS(aHCharHtmlAbsMap) },
759  { aVCharMap, SAL_N_ELEMENTS(aVCharMap) },
760  { aVCharHtmlMap, SAL_N_ELEMENTS(aVCharHtmlMap) },
761  { aVCharHtmlAbsMap, SAL_N_ELEMENTS(aVCharHtmlAbsMap) },
762  { aVAsCharMap, SAL_N_ELEMENTS(aVAsCharMap) },
763  { aVAsCharHtmlMap, SAL_N_ELEMENTS(aVAsCharHtmlMap) }
764  };
765 
766  std::vector<SvxSwFramePosString::StringId> aFrames;
767  for (const FrameMaps & rMap : aMaps)
768  {
769  for (size_t j = 0; j < rMap.nCount; ++j)
770  {
771  aFrames.push_back(rMap.pMap[j].eStrId);
772  aFrames.push_back(rMap.pMap[j].eMirrorStrId);
773  }
774  }
775 
776  std::sort(aFrames.begin(), aFrames.end());
777  aFrames.erase(std::unique(aFrames.begin(), aFrames.end()), aFrames.end());
778 
779  for (const auto& rFrame : aFrames)
780  {
781  m_xHorizontalDLB->append_text(SvxSwFramePosString::GetString(rFrame));
782  }
783 
784  Size aBiggest(m_xHorizontalDLB->get_preferred_size());
785  m_xHorizontalDLB->set_size_request(aBiggest.Width(), -1);
786  m_xVerticalDLB->set_size_request(aBiggest.Width(), -1);
787  m_xHorizontalDLB->clear();
788 }
789 
790 namespace
791 {
792  struct RelationMaps
793  {
794  RelationMap const * pMap;
795  size_t nCount;
796  };
797 }
798 
800 {
801  static const RelationMaps aMaps[] = {
802  { aRelationMap, SAL_N_ELEMENTS(aRelationMap) },
803  { aAsCharRelationMap, SAL_N_ELEMENTS(aAsCharRelationMap) }
804  };
805 
806  std::vector<SvxSwFramePosString::StringId> aRels;
807  for (const RelationMaps & rMap : aMaps)
808  {
809  for (size_t j = 0; j < rMap.nCount; ++j)
810  {
811  aRels.push_back(rMap.pMap[j].eStrId);
812  aRels.push_back(rMap.pMap[j].eMirrorStrId);
813  }
814  }
815 
816  std::sort(aRels.begin(), aRels.end());
817  aRels.erase(std::unique(aRels.begin(), aRels.end()), aRels.end());
818 
819  for (const auto& rRel : aRels)
820  {
822  }
823 
824  Size aBiggest(m_xHoriRelationLB->get_preferred_size());
825  m_xHoriRelationLB->set_size_request(aBiggest.Width(), -1);
826  m_xVertRelationLB->set_size_request(aBiggest.Width(), -1);
827  m_xRelWidthRelationLB->set_size_request(aBiggest.Width(), -1);
828  m_xRelHeightRelationLB->set_size_request(aBiggest.Width(), -1);
829  m_xHoriRelationLB->clear();
830 }
831 
832 std::unique_ptr<SfxTabPage> SwFramePage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
833 {
834  return std::make_unique<SwFramePage>(pPage, pController, *rSet);
835 }
836 
838 {
839  // i#39692 - mustn't be called more than once
840  if (!m_xRealSizeBT->get_visible())
841  {
842  m_xWidthFT->show();
843  m_xWidthAutoFT->hide();
844  m_xAutoHeightCB->hide();
845 
846  m_xHeightFT->show();
847  m_xHeightAutoFT->hide();
848  m_xAutoWidthCB->hide();
849 
850  m_xRealSizeBT->show();
851  }
852 }
853 
855 {
856  return static_cast<SwFrameDlg*>(GetDialogController())->GetWrtShell();
857 }
858 
859 void SwFramePage::Reset( const SfxItemSet *rSet )
860 {
863 
866 
867  FieldUnit aMetric = ::GetDfltMetric(m_bHtmlMode);
868  m_xWidthED->SetMetric(aMetric);
869  m_xHeightED->SetMetric(aMetric);
870  ::SetFieldUnit(*m_xAtHorzPosED, aMetric);
871  ::SetFieldUnit(*m_xAtVertPosED, aMetric);
872 
873  const SfxPoolItem* pItem = nullptr;
874  const SwFormatAnchor& rAnchor = rSet->Get(RES_ANCHOR);
875 
876  if (SfxItemState::SET == rSet->GetItemState(FN_OLE_IS_MATH, false, &pItem))
877  m_bIsMathOLE = static_cast<const SfxBoolItem*>(pItem)->GetValue();
878  if (SfxItemState::SET == rSet->GetItemState(FN_MATH_BASELINE_ALIGNMENT, false, &pItem))
879  m_bIsMathBaselineAlignment = static_cast<const SfxBoolItem*>(pItem)->GetValue();
881  && RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) );
882 
883  if (m_bFormat)
884  {
885  // at formats no to-fly anchor
886  m_xAnchorAtFrameRB->set_sensitive(false);
887  if (rSet->GetItemState(FN_KEEP_ASPECT_RATIO) != SfxItemState::SET)
888  {
889  m_xFixedRatioCB->set_sensitive(false);
890  }
891  }
892  else
893  {
894  if (rAnchor.GetAnchorId() != RndStdIds::FLY_AT_FLY && !pSh->IsFlyInFly())
895  m_xAnchorAtFrameRB->hide();
897  {
898  OUString sHLabel = m_xHorizontalFT->get_label();
899  m_xHorizontalFT->set_label(m_xVerticalFT->get_label());
900  m_xVerticalFT->set_label(sHLabel);
901  m_bIsVerticalFrame = true;
902  }
903  }
904 
905  if ( m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog" )
906  {
907  OSL_ENSURE(pSh , "shell not found");
908  //OS: only for the variant Insert/Graphic/Properties
909  if(SfxItemState::SET == rSet->GetItemState(FN_PARAM_GRF_REALSIZE, false, &pItem))
910  m_aGrfSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
911  else
912  pSh->GetGrfSize( m_aGrfSize );
913 
914  if ( !m_bNew )
915  {
916  m_xRealSizeBT->connect_clicked(LINK(this, SwFramePage, RealSizeHdl));
918  }
919 
920  if (m_sDlgType == "PictureDialog")
921  m_xFixedRatioCB->set_active(false);
922  else
923  {
924  if ( m_bNew )
925  SetPageTitle(SwResId(STR_FRMUI_OLE_INSERT));
926  else
927  SetPageTitle(SwResId(STR_FRMUI_OLE_EDIT));
928  }
929  }
930  else
931  {
932  m_aGrfSize = rSet->Get(RES_FRM_SIZE).GetSize();
933  }
934 
935  // entering percent value made possible
936 
937  // the available space is not yet known so the RefValue has to be calculated from size and relative size values
938  // this is needed only if relative values are already set
939  const SwFormatFrameSize& rFrameSize = rSet->Get(RES_FRM_SIZE);
940 
941  m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME));
942  m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME));
943  if (rFrameSize.GetWidthPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetWidthPercent() != 0)
944  {
945  //calculate the reference value from the width and relative width values
946  sal_Int32 nSpace = rFrameSize.GetWidth() * 100 / rFrameSize.GetWidthPercent();
947  m_xWidthED->SetRefValue( nSpace );
948 
949  m_xRelWidthRelationLB->set_sensitive(true);
950  }
951  else
952  m_xRelWidthRelationLB->set_sensitive(false);
953 
954  m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME));
955  m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME));
956  if (rFrameSize.GetHeightPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetHeightPercent() != 0)
957  {
958  //calculate the reference value from the with and relative width values
959  sal_Int32 nSpace = rFrameSize.GetHeight() * 100 / rFrameSize.GetHeightPercent();
960  m_xHeightED->SetRefValue( nSpace );
961 
962  m_xRelHeightRelationLB->set_sensitive(true);
963  }
964  else
965  m_xRelHeightRelationLB->set_sensitive(false);
966 
967  // general initialisation part
968  switch(rAnchor.GetAnchorId())
969  {
970  case RndStdIds::FLY_AT_PAGE: m_xAnchorAtPageRB->set_active(true); break;
971  case RndStdIds::FLY_AT_PARA: m_xAnchorAtParaRB->set_active(true); break;
972  case RndStdIds::FLY_AT_CHAR: m_xAnchorAtCharRB->set_active(true); break;
973  case RndStdIds::FLY_AS_CHAR: m_xAnchorAsCharRB->set_active(true); break;
974  case RndStdIds::FLY_AT_FLY: m_xAnchorAtFrameRB->set_active(true);break;
975  default:; //prevent warning
976  }
977 
978  // i#22341 - determine content position of character
979  // Note: content position can be NULL
981 
982  // i#18732 - init checkbox value
983  {
984  const bool bFollowTextFlow =
985  rSet->Get(RES_FOLLOW_TEXT_FLOW).GetValue();
986  m_xFollowTextFlowCB->set_active(bFollowTextFlow);
987  }
988 
989  if(m_bHtmlMode)
990  {
991  m_xAutoHeightCB->set_sensitive(false);
992  m_xAutoWidthCB->set_sensitive(false);
993  m_xMirrorPagesCB->hide();
994  if (m_sDlgType == "FrameDialog")
995  m_xFixedRatioCB->set_sensitive(false);
996  // i#18732 hide checkbox in HTML mode
997  m_xFollowTextFlowCB->hide();
998  }
999  else
1000  {
1001  // enable/disable of check box 'Mirror on..'
1002  m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active());
1003 
1004  // enable/disable check box 'Follow text flow'.
1005  // enable check box 'Follow text
1006  // flow' also for anchor type to-frame.
1007  m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() ||
1008  m_xAnchorAtCharRB->get_active() ||
1009  m_xAnchorAtFrameRB->get_active());
1010  }
1011 
1012  Init(*rSet);
1013  m_xAtVertPosED->save_value();
1014  m_xAtHorzPosED->save_value();
1015  m_xFollowTextFlowCB->save_state();
1016 
1017  m_xWidthED->save_value();
1018  m_xHeightED->save_value();
1019 
1020  m_bNoModifyHdl = false;
1021  //lock PercentFields
1022  m_xWidthED->LockAutoCalculation(true);
1023  m_xHeightED->LockAutoCalculation(true);
1024  RangeModifyHdl(); // set all maximum values initially
1025  m_xHeightED->LockAutoCalculation(false);
1026  m_xWidthED->LockAutoCalculation(false);
1027 
1028  m_xAutoHeightCB->save_state();
1029  m_xAutoWidthCB->save_state();
1030 
1031  SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
1032  SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
1033  m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
1034 }
1035 
1036 // stuff attributes into the set when OK
1038 {
1039  bool bRet = false;
1042  OSL_ENSURE( pSh , "shell not found");
1043  const SfxItemSet& rOldSet = GetItemSet();
1044  const SfxPoolItem* pOldItem = nullptr;
1045 
1046  RndStdIds eAnchorId = GetAnchor();
1047 
1048  if ( !m_bFormat || eAnchorId != RndStdIds::FLY_AT_FLY )
1049  {
1050  pOldItem = GetOldItem(*rSet, RES_ANCHOR);
1051  if (m_bNew || !pOldItem || eAnchorId != static_cast<const SwFormatAnchor*>(pOldItem)->GetAnchorId())
1052  {
1053  SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1054  bRet = nullptr != rSet->Put( aAnc );
1055  }
1056  }
1057 
1058  if ( m_pHMap )
1059  {
1060  SwFormatHoriOrient aHoriOrient( rOldSet.Get(RES_HORI_ORIENT) );
1061 
1062  const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
1063  const sal_Int16 eHOri = GetAlignment(m_pHMap, nMapPos, *m_xHoriRelationLB);
1064  const sal_Int16 eRel = GetRelation(*m_xHoriRelationLB);
1065 
1066  aHoriOrient.SetHoriOrient( eHOri );
1067  aHoriOrient.SetRelationOrient( eRel );
1068  aHoriOrient.SetPosToggle(m_xMirrorPagesCB->get_active());
1069 
1070  bool bMod = m_xAtHorzPosED->get_value_changed_from_saved();
1071  bMod |= m_xMirrorPagesCB->get_state_changed_from_saved();
1072 
1073  if ( eHOri == text::HoriOrientation::NONE &&
1074  (m_bNew || (m_bAtHorzPosModified || bMod) || m_nOldH != eHOri ) )
1075  {
1076  SwTwips nX = static_cast< SwTwips >(m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)));
1077  aHoriOrient.SetPos( nX );
1078  }
1079 
1080  pOldItem = GetOldItem(*rSet, FN_HORI_ORIENT);
1081  bool bSame = false;
1082  if ((m_bNew == m_bFormat) && pOldItem)
1083  {
1084  bSame = aHoriOrient == static_cast<const SwFormatHoriOrient&>(*pOldItem);
1085  }
1086  if ((m_bNew && !m_bFormat) || ((m_bAtHorzPosModified || bMod) && !bSame))
1087  {
1088  bRet |= nullptr != rSet->Put( aHoriOrient );
1089  }
1090  }
1091 
1092  if ( m_pVMap )
1093  {
1094  // alignment vertical
1095  SwFormatVertOrient aVertOrient( rOldSet.Get(RES_VERT_ORIENT) );
1096 
1097  const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
1098  const sal_Int16 eVOri = GetAlignment(m_pVMap, nMapPos, *m_xVertRelationLB);
1099  const sal_Int16 eRel = GetRelation(*m_xVertRelationLB);
1100 
1101  aVertOrient.SetVertOrient ( eVOri);
1102  aVertOrient.SetRelationOrient( eRel );
1103 
1104  bool bMod = m_xAtVertPosED->get_value_changed_from_saved();
1105 
1106  if ( eVOri == text::VertOrientation::NONE &&
1107  ( m_bNew || (m_bAtVertPosModified || bMod) || m_nOldV != eVOri) )
1108  {
1109  // vertical position
1110  // recalculate offset for character bound frames
1111  SwTwips nY = static_cast< SwTwips >(m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)));
1112  if (eAnchorId == RndStdIds::FLY_AS_CHAR)
1113  {
1114  nY *= -1;
1115  }
1116  aVertOrient.SetPos( nY );
1117  }
1118  pOldItem = GetOldItem(*rSet, FN_VERT_ORIENT);
1119  bool bSame = false;
1120  if((m_bNew == m_bFormat) && pOldItem)
1121  {
1122  bSame = m_bFormat ?
1123  aVertOrient.GetVertOrient() == static_cast<const SwFormatVertOrient*>(pOldItem)->GetVertOrient() &&
1124  aVertOrient.GetRelationOrient() == static_cast<const SwFormatVertOrient*>(pOldItem)->GetRelationOrient() &&
1125  aVertOrient.GetPos() == static_cast<const SwFormatVertOrient*>(pOldItem)->GetPos()
1126  : aVertOrient == static_cast<const SwFormatVertOrient&>(*pOldItem);
1127  }
1128  if( ( m_bNew && !m_bFormat ) || ((m_bAtVertPosModified || bMod) && !bSame ))
1129  {
1130  bRet |= nullptr != rSet->Put( aVertOrient );
1131  }
1132  }
1133 
1134  // set size
1135  // new exception: when the size of pMgr(, 0), then the properties
1136  // for a graphic that isn't even loaded, are set. Then no SetSize
1137  // is done here when the size settings were not changed by the
1138  // user.
1139  const SwFormatFrameSize& rOldSize = rOldSet.Get(RES_FRM_SIZE);
1140  SwFormatFrameSize aSz( rOldSize );
1141 
1142  auto nRelWidthRelation = m_xRelWidthRelationLB->get_active();
1143  if (nRelWidthRelation != -1)
1144  {
1145  if (nRelWidthRelation == 0)
1146  aSz.SetWidthPercentRelation(text::RelOrientation::FRAME);
1147  else if (nRelWidthRelation == 1)
1148  aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME);
1149  }
1150  auto nRelHeightRelation = m_xRelHeightRelationLB->get_active();
1151  if (nRelHeightRelation != -1)
1152  {
1153  if (nRelHeightRelation == 0)
1154  aSz.SetHeightPercentRelation(text::RelOrientation::FRAME);
1155  else if (nRelHeightRelation == 1)
1156  aSz.SetHeightPercentRelation(text::RelOrientation::PAGE_FRAME);
1157  }
1158 
1159  bool bValueModified = m_xWidthED->get_value_changed_from_saved() ||
1160  m_xHeightED->get_value_changed_from_saved();
1161  bool bCheckChanged = m_xRelWidthCB->get_state_changed_from_saved() ||
1162  m_xRelHeightCB->get_state_changed_from_saved();
1163 
1164  bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() &&
1165  m_xWidthED->get_value() == m_xWidthED->get_min() &&
1166  m_xHeightED->get_value() == m_xHeightED->get_min());
1167 
1168  if ((m_bNew && !m_bFormat) || ((bValueModified || bCheckChanged) && bLegalValue))
1169  {
1170  sal_Int64 nNewWidth = m_xWidthED->DenormalizePercent(m_xWidthED->GetRealValue(FieldUnit::TWIP));
1171  sal_Int64 nNewHeight = m_xHeightED->DenormalizePercent(m_xHeightED->GetRealValue(FieldUnit::TWIP));
1172  aSz.SetWidth (static_cast< SwTwips >(nNewWidth));
1173  aSz.SetHeight(static_cast< SwTwips >(nNewHeight));
1174 
1175  if (m_xRelWidthCB->get_active())
1176  {
1177  aSz.SetWidthPercent(static_cast<sal_uInt8>(std::min(MAX_PERCENT_WIDTH, m_xWidthED->Convert(m_xWidthED->NormalizePercent(nNewWidth), FieldUnit::TWIP, FieldUnit::PERCENT))));
1178  }
1179  else
1180  aSz.SetWidthPercent(0);
1181  if (m_xRelHeightCB->get_active())
1182  aSz.SetHeightPercent(static_cast<sal_uInt8>(std::min(MAX_PERCENT_HEIGHT, m_xHeightED->Convert(m_xHeightED->NormalizePercent(nNewHeight), FieldUnit::TWIP, FieldUnit::PERCENT))));
1183  else
1184  aSz.SetHeightPercent(0);
1185 
1186  if (m_xFixedRatioCB->get_active() && (m_xRelWidthCB->get_active() != m_xRelHeightCB->get_active()))
1187  {
1188  if (m_xRelWidthCB->get_active())
1190  else
1192  }
1193  }
1194  if( !IsInGraficMode() )
1195  {
1196  if (m_xAutoHeightCB->get_state_changed_from_saved())
1197  {
1199  if( eFrameSize != aSz.GetHeightSizeType() )
1200  aSz.SetHeightSizeType(eFrameSize);
1201  }
1202  if (m_xAutoWidthCB->get_state_changed_from_saved())
1203  {
1204  SwFrameSize eFrameSize = m_xAutoWidthCB->get_active()? SwFrameSize::Minimum : SwFrameSize::Fixed;
1205  if( eFrameSize != aSz.GetWidthSizeType() )
1206  aSz.SetWidthSizeType( eFrameSize );
1207  }
1208  }
1209  if (m_xFixedRatioCB->get_state_changed_from_saved())
1210  bRet |= nullptr != rSet->Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, m_xFixedRatioCB->get_active()));
1211 
1212  pOldItem = GetOldItem(*rSet, RES_FRM_SIZE);
1213 
1214  if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !m_bFormat) ||
1215  (m_bFormat &&
1216  (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
1217  (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))
1218  {
1219  if (aSz.GetHeightSizeType() == SwFrameSize::Variable) // there is no VAR_SIZE in frames
1221 
1222  bRet |= nullptr != rSet->Put( aSz );
1223  }
1224  if (m_xFollowTextFlowCB->get_state_changed_from_saved())
1225  {
1226  bRet |= nullptr != rSet->Put(SwFormatFollowTextFlow(m_xFollowTextFlowCB->get_active()));
1227  }
1228  return bRet;
1229 }
1230 
1231 // initialise horizontal and vertical Pos
1233  sal_Int16 nH,
1234  sal_Int16 nHRel,
1235  sal_Int16 nV,
1236  sal_Int16 nVRel,
1237  tools::Long nX,
1238  tools::Long nY)
1239 {
1240  auto nPos = m_xVerticalDLB->get_active();
1241  if (nPos != -1 && m_pVMap)
1242  {
1244 
1245  nPos = m_xVertRelationLB->get_active();
1246  if (nPos != -1)
1247  m_nOldVRel = reinterpret_cast<RelationMap*>(m_xVertRelationLB->get_id(nPos).toInt64())->nRelation;
1248  }
1249 
1250  nPos = m_xHorizontalDLB->get_active();
1251  if (nPos != -1 && m_pHMap)
1252  {
1254 
1255  nPos = m_xHoriRelationLB->get_active();
1256  if (nPos != -1)
1257  m_nOldHRel = reinterpret_cast<RelationMap*>(m_xHoriRelationLB->get_id(nPos).toInt64())->nRelation;
1258  }
1259 
1260  bool bEnable = true;
1261  if ( eId == RndStdIds::FLY_AT_PAGE )
1262  {
1263  m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap;
1264  m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap;
1265  }
1266  else if ( eId == RndStdIds::FLY_AT_FLY )
1267  {
1268  // own vertical alignment map for to frame
1269  // anchored objects.
1270  m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
1271  m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
1272  }
1273  else if ( eId == RndStdIds::FLY_AT_PARA )
1274  {
1275  if(m_bHtmlMode)
1276  {
1279  }
1280  else
1281  {
1282  m_pVMap = aVParaMap;
1283  m_pHMap = aHParaMap;
1284  }
1285  }
1286  else if ( eId == RndStdIds::FLY_AT_CHAR )
1287  {
1288  if(m_bHtmlMode)
1289  {
1292  }
1293  else
1294  {
1295  m_pVMap = aVCharMap;
1296  m_pHMap = aHCharMap;
1297  }
1298  }
1299  else if ( eId == RndStdIds::FLY_AS_CHAR )
1300  {
1301  m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap;
1302  m_pHMap = nullptr;
1303  bEnable = false;
1304  }
1305  m_xHorizontalDLB->set_sensitive( bEnable );
1306  m_xHorizontalFT->set_sensitive( bEnable );
1307 
1308  // select current Pos
1309  // horizontal
1310  if ( nH < 0 )
1311  {
1312  nH = m_nOldH;
1313  nHRel = m_nOldHRel;
1314  }
1315  sal_Int32 nMapPos = FillPosLB(m_pHMap, nH, nHRel, *m_xHorizontalDLB);
1316  FillRelLB(m_pHMap, nMapPos, nH, nHRel, *m_xHoriRelationLB, *m_xHoriRelationFT);
1317 
1318  // vertical
1319  if ( nV < 0 )
1320  {
1321  nV = m_nOldV;
1322  nVRel = m_nOldVRel;
1323  }
1324  nMapPos = FillPosLB(m_pVMap, nV, nVRel, *m_xVerticalDLB);
1325  FillRelLB(m_pVMap, nMapPos, nV, nVRel, *m_xVertRelationLB, *m_xVertRelationFT);
1326 
1327  bEnable = nH == text::HoriOrientation::NONE && eId != RndStdIds::FLY_AS_CHAR;
1328  if (!bEnable)
1329  m_xAtHorzPosED->set_value(0, FieldUnit::TWIP);
1330  else
1331  {
1332  if (nX != LONG_MAX)
1333  m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(nX), FieldUnit::TWIP);
1334  }
1335  m_xAtHorzPosFT->set_sensitive( bEnable );
1336  m_xAtHorzPosED->set_sensitive( bEnable );
1337 
1338  bEnable = nV == text::VertOrientation::NONE;
1339  if ( !bEnable )
1340  m_xAtVertPosED->set_value(0, FieldUnit::TWIP);
1341  else
1342  {
1343  if (eId == RndStdIds::FLY_AS_CHAR)
1344  {
1345  if ( nY == LONG_MAX )
1346  nY = 0;
1347  else
1348  nY *= -1;
1349  }
1350  if ( nY != LONG_MAX )
1351  m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(nY), FieldUnit::TWIP);
1352  }
1353  m_xAtVertPosFT->set_sensitive( bEnable && m_bAllowVertPositioning );
1354  m_xAtVertPosED->set_sensitive( bEnable && m_bAllowVertPositioning );
1355  UpdateExample();
1356 }
1357 
1358 sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
1359  const sal_Int16 _nAlign,
1360  const sal_Int16 _nRel,
1361  weld::ComboBox& _rLB )
1362 {
1363  OUString sSelEntry;
1364  const OUString sOldEntry = _rLB.get_active_text();
1365 
1366  _rLB.clear();
1367 
1368  // i#22341 determine all possible listbox relations for
1369  // given relation for map <aVCharMap>
1370  const LB nLBRelations = (_pMap != aVCharMap)
1371  ? LB::NONE
1372  : ::lcl_GetLBRelationsForRelations( _nRel );
1373 
1374  // fill Listbox
1375  size_t nCount = ::lcl_GetFrameMapCount(_pMap);
1376  for (size_t i = 0; _pMap && i < nCount; ++i)
1377  {
1378 // Why not from the left/from inside or from above?
1379  SvxSwFramePosString::StringId eStrId = m_xMirrorPagesCB->get_active() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
1380  // --> OD 2009-08-31 #mongolianlayout#
1381  eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
1385  OUString sEntry(SvxSwFramePosString::GetString(eStrId));
1386  if (_rLB.find_text(sEntry) == -1)
1387  {
1388  // don't insert entries when frames are character bound
1389  _rLB.append_text(sEntry);
1390  }
1391  // i#22341 - add condition to handle map <aVCharMap>
1392  // that is ambiguous in the alignment.
1393  if ( _pMap[i].nAlign == _nAlign &&
1394  ( (_pMap != aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
1395  {
1396  sSelEntry = sEntry;
1397  }
1398  }
1399 
1400  _rLB.set_active_text(sSelEntry);
1401  if (_rLB.get_active() == -1)
1402  _rLB.set_active_text(sOldEntry);
1403 
1404  if (_rLB.get_active() == -1)
1405  _rLB.set_active(0);
1406 
1407  PosHdl(_rLB);
1408 
1409  return GetMapPos(_pMap, _rLB);
1410 }
1411 
1413  const sal_uInt16 _nLBSelPos,
1414  const sal_Int16 _nAlign,
1415  const sal_Int16 _nRel,
1416  weld::ComboBox& _rLB,
1417  weld::Label& _rFT)
1418 {
1419  OUString sSelEntry;
1420  LB nLBRelations = LB::NONE;
1421  size_t nMapCount = ::lcl_GetFrameMapCount(_pMap);
1422 
1423  _rLB.clear();
1424 
1425  if (_nLBSelPos < nMapCount)
1426  {
1427  if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
1428  {
1429  const OUString sOldEntry(_rLB.get_active_text());
1430  SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
1431 
1432  for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
1433  {
1434  if (_pMap[nMapPos].eStrId == eStrId)
1435  {
1436  nLBRelations = _pMap[nMapPos].nLBRelations;
1437  for (RelationMap const & rCharMap : aAsCharRelationMap)
1438  {
1439  if (nLBRelations & rCharMap.nLBRelation)
1440  {
1441  // --> OD 2009-08-31 #mongolianlayout#
1443  lcl_ChangeResIdToVerticalOrRTL( rCharMap.eStrId,
1447  const OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
1448  _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rCharMap)), sEntry);
1449  if (_pMap[nMapPos].nAlign == _nAlign)
1450  sSelEntry = sEntry;
1451  break;
1452  }
1453  }
1454  }
1455  }
1456  if (!sSelEntry.isEmpty())
1457  _rLB.set_active_text(sSelEntry);
1458  else
1459  {
1460  _rLB.set_active_text(sOldEntry);
1461 
1462  if (_rLB.get_active() == -1)
1463  {
1464  for (int i = 0; i < _rLB.get_count(); i++)
1465  {
1466  RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64());
1467  if (pEntry->nLBRelation == LB::RelChar) // default
1468  {
1469  _rLB.set_active(i);
1470  break;
1471  }
1472  }
1473  }
1474  }
1475  }
1476  else
1477  {
1478  // special handling for map <aVCharMap>,
1479  // because its ambiguous in its <eStrId>/<eMirrorStrId>.
1480  if ( _pMap == aVCharMap )
1481  {
1482  nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap,
1483  ( m_xMirrorPagesCB->get_active()
1484  ? _pMap[_nLBSelPos].eMirrorStrId
1485  : _pMap[_nLBSelPos].eStrId),
1486  m_xMirrorPagesCB->get_active() );
1487  }
1488  else
1489  {
1490  nLBRelations = _pMap[_nLBSelPos].nLBRelations;
1491  }
1492 
1493  for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1)
1494  {
1495  if (nLBRelations & static_cast<LB>(nBit))
1496  {
1497  for (RelationMap const & rMap : aRelationMap)
1498  {
1499  if (rMap.nLBRelation == static_cast<LB>(nBit))
1500  {
1501  SvxSwFramePosString::StringId eStrId1 = m_xMirrorPagesCB->get_active() ?
1502  rMap.eMirrorStrId : rMap.eStrId;
1503  // --> OD 2009-08-31 #mongolianlayout#
1504  eStrId1 =
1509  const OUString sEntry = SvxSwFramePosString::GetString(eStrId1);
1510  _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rMap)), sEntry);
1511  if (sSelEntry.isEmpty() && rMap.nRelation == _nRel)
1512  sSelEntry = sEntry;
1513  }
1514  }
1515  }
1516  }
1517  if (!sSelEntry.isEmpty())
1518  _rLB.set_active_text(sSelEntry);
1519  else
1520  {
1521  // Probably anchor switch. So look for similar relation
1522  sal_Int16 nSimRel = -1;
1523  switch (_nRel)
1524  {
1525  case text::RelOrientation::FRAME:
1526  nSimRel = text::RelOrientation::PAGE_FRAME;
1527  break;
1528  case text::RelOrientation::PRINT_AREA:
1529  nSimRel = text::RelOrientation::PAGE_PRINT_AREA;
1530  break;
1531  case text::RelOrientation::PAGE_LEFT:
1532  nSimRel = text::RelOrientation::FRAME_LEFT;
1533  break;
1534  case text::RelOrientation::PAGE_RIGHT:
1535  nSimRel = text::RelOrientation::FRAME_RIGHT;
1536  break;
1537  case text::RelOrientation::FRAME_LEFT:
1538  nSimRel = text::RelOrientation::PAGE_LEFT;
1539  break;
1540  case text::RelOrientation::FRAME_RIGHT:
1541  nSimRel = text::RelOrientation::PAGE_RIGHT;
1542  break;
1543  case text::RelOrientation::PAGE_FRAME:
1544  nSimRel = text::RelOrientation::FRAME;
1545  break;
1546  case text::RelOrientation::PAGE_PRINT_AREA:
1547  nSimRel = text::RelOrientation::PRINT_AREA;
1548  break;
1549 
1550  default:
1551  if (_rLB.get_active() != -1)
1552  {
1553  RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(_rLB.get_count() - 1).toInt64());
1554  nSimRel = pEntry->nRelation;
1555  }
1556  break;
1557  }
1558 
1559  for (int i = 0; i < _rLB.get_count(); i++)
1560  {
1561  RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64());
1562  if (pEntry->nRelation == nSimRel)
1563  {
1564  _rLB.set_active(i);
1565  break;
1566  }
1567  }
1568 
1569  if (_rLB.get_active() == -1)
1570  _rLB.set_active(0);
1571  }
1572  }
1573  }
1574 
1575  const bool bEnable = _rLB.get_count() != 0
1576  && (&_rLB != m_xVertRelationLB.get() || m_bAllowVertPositioning);
1577  _rLB.set_sensitive( bEnable );
1578  _rFT.set_sensitive( bEnable );
1579 
1580  RelHdl(_rLB);
1581 }
1582 
1583 sal_Int16 SwFramePage::GetRelation(const weld::ComboBox& rRelationLB)
1584 {
1585  const auto nPos = rRelationLB.get_active();
1586  if (nPos != -1)
1587  {
1588  RelationMap *pEntry = reinterpret_cast<RelationMap *>(rRelationLB.get_id(nPos).toInt64());
1589  return pEntry->nRelation;
1590  }
1591 
1592  return 0;
1593 }
1594 
1595 sal_Int16 SwFramePage::GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos,
1596  const weld::ComboBox& rRelationLB)
1597 {
1598  if (!pMap || nMapPos < 0)
1599  return 0;
1600 
1601  const size_t nMapCount = ::lcl_GetFrameMapCount(pMap);
1602 
1603  if (o3tl::make_unsigned(nMapPos) >= nMapCount)
1604  return 0;
1605 
1606  // i#22341 special handling also for map <aVCharMap>,
1607  // because it contains ambiguous items for alignment
1608  if ( pMap != aVAsCharHtmlMap && pMap != aVAsCharMap && pMap != aVCharMap )
1609  return pMap[nMapPos].nAlign;
1610 
1611  if (rRelationLB.get_active() == -1)
1612  return 0;
1613 
1614  const RelationMap *const pRelationMap = reinterpret_cast<const RelationMap *>(
1615  rRelationLB.get_active_id().toInt64());
1616  const LB nRel = pRelationMap->nLBRelation;
1617  const SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
1618 
1619  for (size_t i = 0; i < nMapCount; ++i)
1620  {
1621  if (pMap[i].eStrId == eStrId && (pMap[i].nLBRelations & nRel))
1622  return pMap[i].nAlign;
1623  }
1624 
1625  return 0;
1626 }
1627 
1628 sal_Int32 SwFramePage::GetMapPos(const FrameMap *pMap, const weld::ComboBox& rAlignLB)
1629 {
1630  sal_Int32 nMapPos = 0;
1631  auto nLBSelPos = rAlignLB.get_active();
1632 
1633  if (nLBSelPos != -1)
1634  {
1635  if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
1636  {
1637  const size_t nMapCount = ::lcl_GetFrameMapCount(pMap);
1638  const OUString sSelEntry(rAlignLB.get_active_text());
1639 
1640  for (size_t i = 0; i < nMapCount; i++)
1641  {
1642  SvxSwFramePosString::StringId eResId = pMap[i].eStrId;
1643 
1644  OUString sEntry = SvxSwFramePosString::GetString(eResId);
1645  sEntry = MnemonicGenerator::EraseAllMnemonicChars( sEntry );
1646 
1647  if (sEntry == sSelEntry)
1648  {
1649  nMapPos = static_cast< sal_Int32 >(i);
1650  break;
1651  }
1652  }
1653  }
1654  else
1655  nMapPos = nLBSelPos;
1656  }
1657 
1658  return nMapPos;
1659 }
1660 
1662 {
1663  RndStdIds nRet = RndStdIds::FLY_AT_PAGE;
1664  if (m_xAnchorAtParaRB->get_active())
1665  {
1666  nRet = RndStdIds::FLY_AT_PARA;
1667  }
1668  else if (m_xAnchorAtCharRB->get_active())
1669  {
1670  nRet = RndStdIds::FLY_AT_CHAR;
1671  }
1672  else if (m_xAnchorAsCharRB->get_active())
1673  {
1674  nRet = RndStdIds::FLY_AS_CHAR;
1675  }
1676  else if (m_xAnchorAtFrameRB->get_active())
1677  {
1678  nRet = RndStdIds::FLY_AT_FLY;
1679  }
1680  return nRet;
1681 }
1682 
1683 // Bsp - Update
1685 {
1686  m_bNoModifyHdl = true;
1687  Init(rSet);
1688  m_bNoModifyHdl = false;
1689  //lock PercentFields
1690  m_xWidthED->LockAutoCalculation(true);
1691  m_xHeightED->LockAutoCalculation(true);
1692  RangeModifyHdl(); // set all maximum values initially
1693  m_xHeightED->LockAutoCalculation(false);
1694  m_xWidthED->LockAutoCalculation(false);
1695  m_xFollowTextFlowCB->save_state();
1696 }
1697 
1699 {
1700  if ( _pSet )
1701  {
1702  FillItemSet( _pSet );
1703 
1704  if (!m_bFormat) // tdf#112574 no anchor in styles
1705  {
1706  //FillItemSet doesn't set the anchor into the set when it matches
1707  //the original. But for the other pages we need the current anchor.
1710  RndStdIds eAnchorId = GetAnchor();
1711  SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
1712  _pSet->Put( aAnc );
1713  }
1714  }
1715 
1716  return DeactivateRC::LeavePage;
1717 }
1718 
1719 // swap left/right with inside/outside
1721 {
1722  RndStdIds eId = GetAnchor();
1723  InitPos(eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
1724 }
1725 
1726 IMPL_LINK( SwFramePage, RelSizeClickHdl, weld::Toggleable&, rBtn, void )
1727 {
1728  if (&rBtn == m_xRelWidthCB.get())
1729  {
1730  m_xWidthED->ShowPercent(rBtn.get_active());
1731  m_xRelWidthRelationLB->set_sensitive(rBtn.get_active());
1732  if (rBtn.get_active())
1733  m_xWidthED->get()->set_max(MAX_PERCENT_WIDTH, FieldUnit::NONE);
1734  }
1735  else // rBtn == m_xRelHeightCB.get()
1736  {
1737  m_xHeightED->ShowPercent(rBtn.get_active());
1738  m_xRelHeightRelationLB->set_sensitive(rBtn.get_active());
1739  if (rBtn.get_active())
1740  m_xHeightED->get()->set_max(MAX_PERCENT_HEIGHT, FieldUnit::NONE);
1741  }
1742 
1743  RangeModifyHdl(); // correct the values again
1744 
1745  if (&rBtn == m_xRelWidthCB.get())
1746  ModifyHdl(*m_xWidthED->get());
1747  else // rBtn == m_xRelHeightCB.get()
1748  ModifyHdl(*m_xHeightED->get());
1749 }
1750 
1751 // range check
1752 IMPL_LINK_NOARG(SwFramePage, RangeModifyClickHdl, weld::Toggleable&, void)
1753 {
1754  RangeModifyHdl();
1755 }
1756 
1758 {
1759  if (m_bNoModifyHdl)
1760  return;
1761 
1764  OSL_ENSURE(pSh , "shell not found");
1765  SwFlyFrameAttrMgr aMgr( m_bNew, pSh, GetItemSet() );
1766  SvxSwFrameValidation aVal;
1767 
1768  aVal.nAnchorType = GetAnchor();
1769  aVal.bAutoHeight = m_xAutoHeightCB->get_active();
1770  aVal.bMirror = m_xMirrorPagesCB->get_active();
1771  aVal.bFollowTextFlow = m_xFollowTextFlowCB->get_active();
1772 
1773  if ( m_pHMap )
1774  {
1775  // alignment horizontal
1776  const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
1779  }
1780  else
1782 
1783  if ( m_pVMap )
1784  {
1785  // alignment vertical
1786  const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
1789  }
1790  else
1792 
1793  const tools::Long nAtHorzPosVal = static_cast< tools::Long >(
1794  m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)) );
1795  const tools::Long nAtVertPosVal = static_cast< tools::Long >(
1796  m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)) );
1797 
1798  aVal.nHPos = nAtHorzPosVal;
1799  aVal.nVPos = nAtVertPosVal;
1800 
1801  aMgr.ValidateMetrics(aVal, mpToCharContentPos, true); // one time, to get reference values for percental values
1802 
1803  // set reference values for percental values (100%) ...
1804  m_xWidthED->SetRefValue(aVal.aPercentSize.Width());
1805  m_xHeightED->SetRefValue(aVal.aPercentSize.Height());
1806 
1807  // ... and correctly convert width and height with it
1808  SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
1809  SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
1810  aVal.nWidth = nWidth;
1811  aVal.nHeight = nHeight;
1812 
1813  aMgr.ValidateMetrics(aVal, mpToCharContentPos); // one more time, to determine all remaining values with correct width and height.
1814 
1815  // all columns have to be correct
1816  const SfxItemSet* pExampleSet = GetDialogExampleSet();
1817  if (pExampleSet && SfxItemState::DEFAULT <= pExampleSet->GetItemState(RES_COL))
1818  {
1819  const SwFormatCol& rCol = pExampleSet->Get(RES_COL);
1820  if ( rCol.GetColumns().size() > 1 )
1821  {
1822  for (const SwColumn & i : rCol.GetColumns())
1823  {
1824  aVal.nMinWidth += i.GetLeft() +
1825  i.GetRight() +
1826  MINFLY;
1827  }
1828  aVal.nMinWidth -= MINFLY;//one was already in there!
1829  }
1830  }
1831 
1832  nWidth = aVal.nWidth;
1833  nHeight = aVal.nHeight;
1834 
1835  // minimum range also for template
1836  m_xHeightED->set_min(m_xHeightED->NormalizePercent(aVal.nMinHeight), FieldUnit::TWIP);
1837  m_xWidthED->set_min(m_xWidthED->NormalizePercent(aVal.nMinWidth), FieldUnit::TWIP);
1838 
1839  SwTwips nMaxWidth(aVal.nMaxWidth);
1840  SwTwips nMaxHeight(aVal.nMaxHeight);
1841 
1842  if (aVal.bAutoHeight && (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog"))
1843  {
1844  SwTwips nTmp = std::min(nWidth * nMaxHeight / std::max(nHeight, SwTwips(1)), nMaxHeight);
1845  m_xWidthED->set_max(m_xWidthED->NormalizePercent(nTmp), FieldUnit::TWIP);
1846 
1847  nTmp = std::min(nHeight * nMaxWidth / std::max(nWidth, SwTwips(1)), nMaxWidth);
1848  m_xHeightED->set_max(m_xWidthED->NormalizePercent(nTmp), FieldUnit::TWIP);
1849  }
1850  else
1851  {
1852  SwTwips nTmp = static_cast< SwTwips >(m_xHeightED->NormalizePercent(nMaxHeight));
1853  m_xHeightED->set_max(nTmp, FieldUnit::TWIP);
1854 
1855  nTmp = static_cast< SwTwips >(m_xWidthED->NormalizePercent(nMaxWidth));
1856  m_xWidthED->set_max(nTmp, FieldUnit::TWIP);
1857  }
1858 
1859  m_xAtHorzPosED->set_range(m_xAtHorzPosED->normalize(aVal.nMinHPos),
1860  m_xAtHorzPosED->normalize(aVal.nMaxHPos),
1861  FieldUnit::TWIP);
1862  if (aVal.nHPos != nAtHorzPosVal)
1863  m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(aVal.nHPos), FieldUnit::TWIP);
1864 
1865  const SwTwips nUpperOffset = (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR)
1866  ? m_nUpperBorder : 0;
1867  const SwTwips nLowerOffset = (aVal.nAnchorType == RndStdIds::FLY_AS_CHAR)
1868  ? m_nLowerBorder : 0;
1869 
1870  m_xAtVertPosED->set_range(m_xAtVertPosED->normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset),
1871  m_xAtVertPosED->normalize(aVal.nMaxVPos),
1872  FieldUnit::TWIP);
1873  if (aVal.nVPos != nAtVertPosVal)
1874  m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(aVal.nVPos), FieldUnit::TWIP);
1875 }
1876 
1878 {
1879  m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active());
1880 
1881  // i#18732 - enable check box 'Follow text flow' for anchor
1882  // type to-paragraph' and to-character
1883  // i#22305 - enable check box 'Follow text
1884  // flow' also for anchor type to-frame.
1885  m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() ||
1886  m_xAnchorAtCharRB->get_active() ||
1887  m_xAnchorAtFrameRB->get_active());
1888 
1889  RndStdIds eId = GetAnchor();
1890 
1891  InitPos( eId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
1892  RangeModifyHdl();
1893 
1894  if(m_bHtmlMode)
1895  {
1896  PosHdl(*m_xHorizontalDLB);
1897  PosHdl(*m_xVerticalDLB);
1898  }
1899 
1900  EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
1901  && RndStdIds::FLY_AS_CHAR == eId) );
1902 }
1903 
1904 IMPL_LINK( SwFramePage, PosHdl, weld::ComboBox&, rLB, void )
1905 {
1906  bool bHori = &rLB == m_xHorizontalDLB.get();
1907  weld::ComboBox *pRelLB = bHori ? m_xHoriRelationLB.get() : m_xVertRelationLB.get();
1908  weld::Label *pRelFT = bHori ? m_xHoriRelationFT.get() : m_xVertRelationFT.get();
1909  FrameMap const *pMap = bHori ? m_pHMap : m_pVMap;
1910 
1911  const sal_Int32 nMapPos = GetMapPos(pMap, rLB);
1912  const sal_Int16 nAlign = GetAlignment(pMap, nMapPos, *pRelLB);
1913 
1914  if (bHori)
1915  {
1916  bool bEnable = text::HoriOrientation::NONE == nAlign;
1917  m_xAtHorzPosED->set_sensitive( bEnable );
1918  m_xAtHorzPosFT->set_sensitive( bEnable );
1919  }
1920  else
1921  {
1922  bool bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning;
1923  m_xAtVertPosED->set_sensitive( bEnable );
1924  m_xAtVertPosFT->set_sensitive( bEnable );
1925  }
1926 
1927  RangeModifyHdl();
1928 
1929  sal_Int16 nRel = 0;
1930  if (rLB.get_active() != -1)
1931  {
1932  if (pRelLB->get_active() != -1)
1933  nRel = reinterpret_cast<RelationMap*>(pRelLB->get_active_id().toInt64())->nRelation;
1934  FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
1935  }
1936  else
1937  pRelLB->clear();
1938 
1939  UpdateExample();
1940 
1941  if (bHori)
1942  m_bAtHorzPosModified = true;
1943  else
1944  m_bAtVertPosModified = true;
1945 
1946  // special treatment for HTML-Mode with horizontal-vertical-dependencies
1947  if(!(m_bHtmlMode && (RndStdIds::FLY_AT_CHAR == GetAnchor())))
1948  return;
1949 
1950  bool bSet = false;
1951  if(bHori)
1952  {
1953  // right is allowed only above - from the left only above
1954  // from the left at character -> below
1955  if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
1956  0 == m_xVerticalDLB->get_active())
1957  {
1958  if(text::RelOrientation::FRAME == nRel)
1959  m_xVerticalDLB->set_active(1);
1960  else
1961  m_xVerticalDLB->set_active(0);
1962  bSet = true;
1963  }
1964  else if(text::HoriOrientation::LEFT == nAlign && 1 == m_xVerticalDLB->get_active())
1965  {
1966  m_xVerticalDLB->set_active(0);
1967  bSet = true;
1968  }
1969  else if(text::HoriOrientation::NONE == nAlign && 1 == m_xVerticalDLB->get_active())
1970  {
1971  m_xVerticalDLB->set_active(0);
1972  bSet = true;
1973  }
1974  if(bSet)
1975  PosHdl(*m_xVerticalDLB);
1976  }
1977  else
1978  {
1979  if(text::VertOrientation::TOP == nAlign)
1980  {
1981  if (1 == m_xHorizontalDLB->get_active())
1982  {
1983  m_xHorizontalDLB->set_active(0);
1984  bSet = true;
1985  }
1986  m_xHoriRelationLB->set_active(1);
1987  }
1988  else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
1989  {
1990  if (2 == m_xHorizontalDLB->get_active())
1991  {
1992  m_xHorizontalDLB->set_active(0);
1993  bSet = true;
1994  }
1995  m_xHoriRelationLB->set_active(0) ;
1996  }
1997  if(bSet)
1998  PosHdl(*m_xHorizontalDLB);
1999  }
2000 }
2001 
2002 // horizontal Pos
2003 IMPL_LINK( SwFramePage, RelHdl, weld::ComboBox&, rLB, void )
2004 {
2005  bool bHori = &rLB == m_xHoriRelationLB.get();
2006 
2007  UpdateExample();
2008 
2009  if (bHori)
2010  m_bAtHorzPosModified = true;
2011  else
2012  m_bAtVertPosModified = true;
2013 
2014  if (m_bHtmlMode && (RndStdIds::FLY_AT_CHAR == GetAnchor()))
2015  {
2016  if(bHori)
2017  {
2018  const sal_Int16 nRel = GetRelation(*m_xHoriRelationLB);
2019  if(text::RelOrientation::PRINT_AREA == nRel && 0 == m_xVerticalDLB->get_active())
2020  {
2021  m_xVerticalDLB->set_active(1);
2022  }
2023  else if(text::RelOrientation::CHAR == nRel && 1 == m_xVerticalDLB->get_active())
2024  {
2025  m_xVerticalDLB->set_active(0);
2026  }
2027  }
2028  }
2029  RangeModifyHdl();
2030 }
2031 
2033 {
2034  m_xWidthED->set_value(m_xWidthED->NormalizePercent(m_aGrfSize.Width()), FieldUnit::TWIP);
2035  m_xHeightED->set_value(m_xHeightED->NormalizePercent(m_aGrfSize.Height()), FieldUnit::TWIP);
2036  m_fWidthHeightRatio = m_aGrfSize.Height() ? double(m_aGrfSize.Width()) / double(m_aGrfSize.Height()) : 1.0;
2037  UpdateExample();
2038 }
2039 
2040 IMPL_LINK_NOARG(SwFramePage, AutoWidthClickHdl, weld::Toggleable&, void)
2041 {
2042  if( !IsInGraficMode() )
2043  HandleAutoCB( m_xAutoWidthCB->get_active(), *m_xWidthFT, *m_xWidthAutoFT, *m_xWidthED->get() );
2044 }
2045 
2046 IMPL_LINK_NOARG(SwFramePage, AutoHeightClickHdl, weld::Toggleable&, void)
2047 {
2048  if (!IsInGraficMode())
2049  HandleAutoCB(m_xAutoHeightCB->get_active(), *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get());
2050 }
2051 
2052 IMPL_LINK( SwFramePage, ModifyHdl, weld::MetricSpinButton&, rEdit, void )
2053 {
2054  SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
2055  SwTwips nHeight = static_cast< SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
2056  if (m_xFixedRatioCB->get_active())
2057  {
2058  if (&rEdit == m_xWidthED->get())
2059  {
2060  nHeight = SwTwips(static_cast<double>(nWidth) / m_fWidthHeightRatio);
2061  m_xHeightED->set_value(m_xHeightED->NormalizePercent(nHeight), FieldUnit::TWIP);
2062  }
2063  else if (&rEdit == m_xHeightED->get())
2064  {
2065  nWidth = SwTwips(static_cast<double>(nHeight) * m_fWidthHeightRatio);
2066  m_xWidthED->set_value(m_xWidthED->NormalizePercent(nWidth), FieldUnit::TWIP);
2067  }
2068  }
2069  m_fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
2070  UpdateExample();
2071 }
2072 
2074 {
2075  auto nPos = m_xHorizontalDLB->get_active();
2076  if (m_pHMap && nPos != -1)
2077  {
2078  const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
2081  }
2082 
2083  nPos = m_xVerticalDLB->get_active();
2084  if (m_pVMap && nPos != -1)
2085  {
2086  const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
2089  }
2090 
2091  // size
2092  auto nXPos = m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP));
2093  auto nYPos = m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP));
2094  m_aExampleWN.SetRelPos(Point(nXPos, nYPos));
2095 
2097  m_aExampleWN.Invalidate();
2098 }
2099 
2101 {
2102  if(!m_bFormat)
2103  {
2105 
2106  // size
2107  const bool bSizeFixed = pSh->IsSelObjProtected( FlyProtectFlags::Fixed ) != FlyProtectFlags::NONE;
2108 
2109  m_xWidthED->set_sensitive( !bSizeFixed );
2110  m_xHeightED->set_sensitive( !bSizeFixed );
2111 
2112  // size controls for math OLE objects
2113  if ( m_sDlgType == "ObjectDialog" && ! m_bNew )
2114  {
2115  // disable width and height for math objects
2116  const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() );
2117 
2118  static struct GlobalNameId {
2119  sal_uInt32 n1;
2120  sal_uInt16 n2, n3;
2121  sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15;
2122  } const aGlbNmIds[] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 },
2124 
2125  for (const GlobalNameId & rId : aGlbNmIds) {
2126  SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
2127  rId.b8, rId.b9, rId.b10, rId.b11,
2128  rId.b12, rId.b13, rId.b14, rId.b15 );
2129 
2130  if( rFactNm == aGlbNm )
2131  {
2132  // disable size controls for math OLE objects
2133  m_xWidthFT->set_sensitive(false);
2134  m_xWidthED->set_sensitive(false);
2135  m_xRelWidthCB->set_sensitive(false);
2136  m_xHeightFT->set_sensitive(false);
2137  m_xHeightED->set_sensitive(false);
2138  m_xRelHeightCB->set_sensitive(false);
2139  m_xFixedRatioCB->set_sensitive(false);
2140  m_xRealSizeBT->set_sensitive(false);
2141  break;
2142  }
2143  }
2144 
2145  // TODO/LATER: get correct aspect
2146  if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
2147  m_xRealSizeBT->set_sensitive(false);
2148  }
2149  }
2150 
2151  const SwFormatFrameSize& rSize = rSet.Get(RES_FRM_SIZE);
2152  sal_Int64 nWidth = m_xWidthED->NormalizePercent(rSize.GetWidth());
2153  sal_Int64 nHeight = m_xHeightED->NormalizePercent(rSize.GetHeight());
2154 
2155  if (nWidth != m_xWidthED->get_value(FieldUnit::TWIP))
2156  m_xWidthED->set_value(nWidth, FieldUnit::TWIP);
2157 
2158  if (nHeight != m_xHeightED->get_value(FieldUnit::TWIP))
2159  m_xHeightED->set_value(nHeight, FieldUnit::TWIP);
2160 
2161  if (!IsInGraficMode())
2162  {
2163  SwFrameSize eSize = rSize.GetHeightSizeType();
2164  bool bCheck = eSize != SwFrameSize::Fixed;
2165  m_xAutoHeightCB->set_active(bCheck);
2166  HandleAutoCB( bCheck, *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get() );
2167  if( eSize == SwFrameSize::Variable )
2168  m_xHeightED->set_value(m_xHeightED->get_min());
2169 
2170  eSize = rSize.GetWidthSizeType();
2171  bCheck = eSize != SwFrameSize::Fixed;
2172  m_xAutoWidthCB->set_active(bCheck);
2173  HandleAutoCB( bCheck, *m_xWidthFT, *m_xWidthAutoFT, *m_xWidthED->get() );
2174  if( eSize == SwFrameSize::Variable )
2175  m_xWidthED->set_value(m_xWidthED->get_min());
2176 
2177  if ( !m_bFormat )
2178  {
2180  const SwFrameFormat* pFormat = pSh->GetFlyFrameFormat();
2181  if( pFormat && pFormat->GetChain().GetNext() )
2182  m_xAutoHeightCB->set_sensitive( false );
2183  }
2184  }
2185  else
2186  m_xAutoHeightCB->hide();
2187 
2188  // organise circulation-gap for character bound frames
2189  const SvxULSpaceItem &rUL = rSet.Get(RES_UL_SPACE);
2190  m_nUpperBorder = rUL.GetUpper();
2191  m_nLowerBorder = rUL.GetLower();
2192 
2193  if(SfxItemState::SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO))
2194  {
2195  m_xFixedRatioCB->set_active(static_cast<const SfxBoolItem&>(rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue());
2196  m_xFixedRatioCB->save_state();
2197  }
2198 
2199  // columns
2200  SwFormatCol aCol( rSet.Get(RES_COL) );
2201  ::FitToActualSize( aCol, o3tl::narrowing<sal_uInt16>(rSize.GetWidth()) );
2202 
2203  RndStdIds eAnchorId = GetAnchor();
2204 
2205  if ( m_bNew && !m_bFormat )
2206  InitPos(eAnchorId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
2207  else
2208  {
2209  const SwFormatHoriOrient& rHori = rSet.Get(RES_HORI_ORIENT);
2210  const SwFormatVertOrient& rVert = rSet.Get(RES_VERT_ORIENT);
2211  m_nOldH = rHori.GetHoriOrient();
2212  m_nOldHRel = rHori.GetRelationOrient();
2213  m_nOldV = rVert.GetVertOrient();
2214  m_nOldVRel = rVert.GetRelationOrient();
2215 
2216  if (eAnchorId == RndStdIds::FLY_AT_PAGE)
2217  {
2218  if (m_nOldHRel == text::RelOrientation::FRAME)
2219  m_nOldHRel = text::RelOrientation::PAGE_FRAME;
2220  else if (m_nOldHRel == text::RelOrientation::PRINT_AREA)
2221  m_nOldHRel = text::RelOrientation::PAGE_PRINT_AREA;
2222  if (m_nOldVRel == text::RelOrientation::FRAME)
2223  m_nOldVRel = text::RelOrientation::PAGE_FRAME;
2224  else if (m_nOldVRel == text::RelOrientation::PRINT_AREA)
2225  m_nOldVRel = text::RelOrientation::PAGE_PRINT_AREA;
2226  }
2227 
2228  m_xMirrorPagesCB->set_active(rHori.IsPosToggle());
2229  m_xMirrorPagesCB->save_state();
2230 
2231  InitPos(eAnchorId,
2232  m_nOldH,
2233  m_nOldHRel,
2234  m_nOldV,
2235  m_nOldVRel,
2236  rHori.GetPos(),
2237  rVert.GetPos());
2238  }
2239 
2240  // transparent for example
2241  // circulation for example
2242  const SwFormatSurround& rSurround = rSet.Get(RES_SURROUND);
2243  m_aExampleWN.SetWrap( rSurround.GetSurround() );
2244 
2245  if ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH )
2246  {
2247  const SvxOpaqueItem& rOpaque = rSet.Get(RES_OPAQUE);
2248  m_aExampleWN.SetTransparent(!rOpaque.GetValue());
2249  }
2250 
2251  // switch to percent if applicable
2252  RangeModifyHdl(); // set reference values (for 100%)
2253 
2255  m_xFixedRatioCB->set_active(true);
2256  if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != SwFormatFrameSize::SYNCED &&
2257  !m_xRelWidthCB->get_active())
2258  {
2259  m_xRelWidthCB->set_active(true);
2260  RelSizeClickHdl(*m_xRelWidthCB);
2261  m_xWidthED->set_value(rSize.GetWidthPercent(), FieldUnit::PERCENT);
2262  }
2263  if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
2264  !m_xRelHeightCB->get_active())
2265  {
2266  m_xRelHeightCB->set_active(true);
2267  RelSizeClickHdl(*m_xRelHeightCB);
2268  m_xHeightED->set_value(rSize.GetHeightPercent(), FieldUnit::PERCENT);
2269  }
2270  m_xRelWidthCB->save_state();
2271  m_xRelHeightCB->save_state();
2272 
2273  if (rSize.GetWidthPercentRelation() == text::RelOrientation::PAGE_FRAME)
2274  m_xRelWidthRelationLB->set_active(1);
2275  else
2276  m_xRelWidthRelationLB->set_active(0);
2277 
2278  if (rSize.GetHeightPercentRelation() == text::RelOrientation::PAGE_FRAME)
2279  m_xRelHeightRelationLB->set_active(1);
2280  else
2281  m_xRelHeightRelationLB->set_active(0);
2282 }
2283 
2284 void SwFramePage::SetFormatUsed(bool bFormatUsed)
2285 {
2286  m_bFormat = bFormatUsed;
2287  if (m_bFormat)
2288  m_xAnchorAtFrameRB->hide();
2289 }
2290 
2292 {
2293  m_bAllowVertPositioning = bEnable;
2294  m_xVerticalFT->set_sensitive( bEnable );
2295  m_xVerticalDLB->set_sensitive( bEnable );
2296  m_xAtVertPosFT->set_sensitive( bEnable );
2297  m_xAtVertPosED->set_sensitive( bEnable );
2298  m_xVertRelationFT->set_sensitive( bEnable );
2299  m_xVertRelationLB->set_sensitive( bEnable );
2300 }
2301 
2303  : SfxTabPage(pPage, pController, "modules/swriter/ui/picturepage.ui", "PicturePage", &rSet)
2304  , m_bHtmlMode(false)
2305  , m_xMirror(m_xBuilder->weld_widget("flipframe"))
2306  , m_xMirrorVertBox(m_xBuilder->weld_check_button("vert"))
2307  , m_xMirrorHorzBox(m_xBuilder->weld_check_button("hori"))
2308  , m_xAllPagesRB(m_xBuilder->weld_radio_button("allpages"))
2309  , m_xLeftPagesRB(m_xBuilder->weld_radio_button("leftpages"))
2310  , m_xRightPagesRB(m_xBuilder->weld_radio_button("rightpages"))
2311  , m_xConnectED(m_xBuilder->weld_entry("entry"))
2312  , m_xBrowseBT(m_xBuilder->weld_button("browse"))
2313  , m_xLinkFrame(m_xBuilder->weld_frame("linkframe"))
2314  // RotGrfFlyFrame: Need Angle and RotateControls now
2315  , m_xFlAngle(m_xBuilder->weld_frame("FL_ANGLE"))
2316  , m_xNfAngle(m_xBuilder->weld_metric_spin_button("NF_ANGLE", FieldUnit::DEGREE))
2317  , m_xCtlAngle(new svx::DialControl)
2318  , m_xCtlAngleWin(new weld::CustomWeld(*m_xBuilder, "CTL_ANGLE", *m_xCtlAngle))
2319  , m_xBmpWin(new weld::CustomWeld(*m_xBuilder, "preview", m_aBmpWin))
2320  // tdf#138843 place holder for the graphic type
2321  , m_xLabelGraphicType(m_xBuilder->weld_label("label-graphic-type"))
2322 {
2323  m_aBmpWin.SetBitmapEx(BitmapEx(RID_BMP_PREVIEW_FALLBACK));
2324 
2325  m_xCtlAngle->SetLinkedField(m_xNfAngle.get(), 2);
2326 
2328  m_xMirrorHorzBox->connect_toggled(LINK(this, SwGrfExtPage, MirrorHdl));
2329  m_xMirrorVertBox->connect_toggled(LINK(this, SwGrfExtPage, MirrorHdl));
2330  m_xBrowseBT->connect_clicked(LINK(this, SwGrfExtPage, BrowseHdl));
2331 }
2332 
2334 {
2335  m_xBmpWin.reset();
2336  m_xCtlAngleWin.reset();
2337  m_xCtlAngle.reset();
2338  m_xGrfDlg.reset();
2339 }
2340 
2341 std::unique_ptr<SfxTabPage> SwGrfExtPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
2342 {
2343  return std::make_unique<SwGrfExtPage>(pPage, pController, *rSet);
2344 }
2345 
2347 {
2348  const SfxPoolItem* pItem;
2349  const sal_uInt16 nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
2350  m_bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
2351 
2352  if( SfxItemState::SET == rSet->GetItemState( FN_PARAM_GRF_CONNECT, true, &pItem)
2353  && static_cast<const SfxBoolItem *>(pItem)->GetValue() )
2354  {
2355  m_xBrowseBT->set_sensitive(true);
2356  m_xConnectED->set_editable(true);
2357  }
2358 
2359  // RotGrfFlyFrame: Get RotationAngle and set at control
2360  if(SfxItemState::SET == rSet->GetItemState( SID_ATTR_TRANSFORM_ANGLE, false, &pItem))
2361  {
2362  m_xCtlAngle->SetRotation(static_cast<const SdrAngleItem*>(pItem)->GetValue());
2363  }
2364  else
2365  {
2366  m_xCtlAngle->SetRotation(0_deg100);
2367  }
2368  m_xCtlAngle->SaveValue();
2369 
2370  ActivatePage(*rSet);
2371 }
2372 
2374 {
2375  const SvxProtectItem& rProt = rSet.Get(RES_PROTECT);
2376  bool bProtContent = rProt.IsContentProtected();
2377 
2378  const SfxPoolItem* pItem = nullptr;
2379  bool bEnable = false;
2380  bool bEnableMirrorRB = false;
2381 
2382  SfxItemState eState = rSet.GetItemState(RES_GRFATR_MIRRORGRF, true, &pItem);
2383  if (SfxItemState::UNKNOWN != eState && !bProtContent && !m_bHtmlMode)
2384  {
2385  if( SfxItemState::SET != eState )
2386  pItem = &rSet.Get( RES_GRFATR_MIRRORGRF );
2387 
2388  bEnable = true;
2389 
2390  MirrorGraph eMirror = static_cast<const SwMirrorGrf* >(pItem)->GetValue();
2391  switch( eMirror )
2392  {
2393  case MirrorGraph::Dont: break;
2394  case MirrorGraph::Vertical: m_xMirrorHorzBox->set_active(true); break;
2395  case MirrorGraph::Horizontal: m_xMirrorVertBox->set_active(true); break;
2396  case MirrorGraph::Both: m_xMirrorHorzBox->set_active(true);
2397  m_xMirrorVertBox->set_active(true);
2398  break;
2399  default:
2400  ;
2401  }
2402 
2403  const int nPos = (static_cast<const SwMirrorGrf* >(pItem)->IsGrfToggle() ? 1 : 0)
2404  + ((eMirror == MirrorGraph::Vertical || eMirror == MirrorGraph::Both) ? 2 : 0);
2405 
2406  bEnableMirrorRB = nPos != 0;
2407 
2408  switch (nPos)
2409  {
2410  case 1: // mirror at left / even pages
2411  m_xLeftPagesRB->set_active(true);
2412  m_xMirrorHorzBox->set_active(true);
2413  break;
2414  case 2: // mirror on all pages
2415  m_xAllPagesRB->set_active(true);
2416  break;
2417  case 3: // mirror on right / odd pages
2418  m_xRightPagesRB->set_active(true);
2419  break;
2420  default:
2421  m_xAllPagesRB->set_active(true);
2422  break;
2423  }
2424  }
2425 
2426  if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, false, &pItem ) )
2427  {
2428  const SvxBrushItem& rBrush = *static_cast<const SvxBrushItem*>(pItem);
2429  if( !rBrush.GetGraphicLink().isEmpty() )
2430  {
2431  aGrfName = aNewGrfName = rBrush.GetGraphicLink();
2432  m_xConnectED->set_text(aNewGrfName);
2433  }
2434  OUString referer;
2435  SfxStringItem const * it = static_cast<SfxStringItem const *>(
2436  rSet.GetItem(SID_REFERER));
2437  if (it != nullptr) {
2438  referer = it->GetValue();
2439  }
2440  const Graphic* pGrf = rBrush.GetGraphic(referer);
2441  if( pGrf )
2442  {
2443  m_aBmpWin.SetGraphic( *pGrf );
2445  }
2446  }
2447 
2448  m_xConnectED->save_value();
2449 
2450  m_xMirror->set_sensitive(bEnable);
2451  m_xAllPagesRB->set_sensitive(bEnableMirrorRB);
2452  m_xLeftPagesRB->set_sensitive(bEnableMirrorRB);
2453  m_xRightPagesRB->set_sensitive(bEnableMirrorRB);
2454 
2455  m_xAllPagesRB->save_state();
2456  m_xLeftPagesRB->save_state();
2457  m_xRightPagesRB->save_state();
2458  m_xMirrorHorzBox->save_state();
2459  m_xMirrorVertBox->save_state();
2460 
2461  m_aBmpWin.MirrorHorz( m_xMirrorVertBox->get_active() );
2462  m_aBmpWin.MirrorVert( m_xMirrorHorzBox->get_active() );
2464 }
2465 
2467 {
2468  bool bModified = false;
2469  if ( m_xMirrorHorzBox->get_state_changed_from_saved() ||
2470  m_xMirrorVertBox->get_state_changed_from_saved() ||
2471  m_xAllPagesRB->get_state_changed_from_saved() ||
2472  m_xLeftPagesRB->get_state_changed_from_saved() ||
2473  m_xRightPagesRB->get_state_changed_from_saved() )
2474  {
2475  bModified = true;
2476 
2477  bool bHori = false;
2478 
2479  if (m_xMirrorHorzBox->get_active() &&
2480  !m_xLeftPagesRB->get_active())
2481  bHori = true;
2482 
2483  MirrorGraph eMirror;
2484  eMirror = m_xMirrorVertBox->get_active() && bHori ?
2485  MirrorGraph::Both : bHori ?
2486  MirrorGraph::Vertical : m_xMirrorVertBox->get_active() ?
2488 
2489  bool bMirror = !m_xAllPagesRB->get_active();
2490  SwMirrorGrf aMirror( eMirror );
2491  aMirror.SetGrfToggle(bMirror );
2492  rSet->Put( aMirror );
2493  }
2494 
2495  if (aGrfName != aNewGrfName || m_xConnectED->get_value_changed_from_saved())
2496  {
2497  bModified = true;
2498  aGrfName = m_xConnectED->get_text();
2500  SID_ATTR_GRAF_GRAPHIC ));
2501  }
2502 
2503  // RotGrfFlyFrame: Safe rotation if modified
2504  if(m_xCtlAngle->IsValueModified())
2505  {
2506  rSet->Put(SdrAngleItem(GetWhich(SID_ATTR_TRANSFORM_ANGLE), m_xCtlAngle->GetRotation()));
2507  bModified = true;
2508  }
2509 
2510  return bModified;
2511 }
2512 
2514 {
2515  if( _pSet )
2516  FillItemSet( _pSet );
2517  return DeactivateRC::LeavePage;
2518 }
2519 
2521 {
2522  if(!m_xGrfDlg)
2523  {
2524  m_xGrfDlg.reset(new FileDialogHelper(
2525  ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
2526  FileDialogFlags::Graphic, GetFrameWeld()));
2527  m_xGrfDlg->SetTitle(m_xLinkFrame->get_label());
2528  }
2529  m_xGrfDlg->SetDisplayDirectory(m_xConnectED->get_text());
2530  uno::Reference < ui::dialogs::XFilePicker3 > xFP = m_xGrfDlg->GetFilePicker();
2531  uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY);
2532  xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, uno::makeAny(true) );
2533 
2534  if ( m_xGrfDlg->Execute() != ERRCODE_NONE )
2535  return;
2536 
2537 // remember selected filter
2538  aFilterName = m_xGrfDlg->GetCurrentFilter();
2539  aNewGrfName = INetURLObject::decode( m_xGrfDlg->GetPath(),
2541  m_xConnectED->set_text(aNewGrfName);
2542  //reset mirrors because maybe a Bitmap was swapped with
2543  //another type of graphic that cannot be mirrored.
2544  m_xMirrorVertBox->set_active(false);
2545  m_xMirrorHorzBox->set_active(false);
2546  m_xAllPagesRB->set_sensitive(false);
2547  m_xLeftPagesRB->set_sensitive(false);
2548  m_xRightPagesRB->set_sensitive(false);
2549  m_aBmpWin.MirrorHorz(false);
2550  m_aBmpWin.MirrorVert(false);
2551 
2552  Graphic aGraphic;
2553  (void)GraphicFilter::LoadGraphic(m_xGrfDlg->GetPath(), OUString(), aGraphic);
2554  m_aBmpWin.SetGraphic(aGraphic);
2555  m_xLabelGraphicType->set_label(GraphicHelper::GetImageType(aGraphic));
2556 
2557  bool bEnable = GraphicType::Bitmap == aGraphic.GetType() ||
2558  GraphicType::GdiMetafile == aGraphic.GetType();
2559  m_xMirrorVertBox->set_sensitive(bEnable);
2560  m_xMirrorHorzBox->set_sensitive(bEnable);
2561  m_xAllPagesRB->set_sensitive(bEnable);
2562  m_xLeftPagesRB->set_sensitive(bEnable);
2563  m_xRightPagesRB->set_sensitive(bEnable);
2564 
2565 }
2566 
2568 {
2569  bool bEnable = m_xMirrorHorzBox->get_active();
2570 
2571  m_aBmpWin.MirrorHorz( m_xMirrorVertBox->get_active() );
2572  m_aBmpWin.MirrorVert( bEnable );
2573 
2574  m_xAllPagesRB->set_sensitive(bEnable);
2575  m_xLeftPagesRB->set_sensitive(bEnable);
2576  m_xRightPagesRB->set_sensitive(bEnable);
2577 
2578  if (!m_xAllPagesRB->get_active() && !m_xLeftPagesRB->get_active() && !m_xRightPagesRB->get_active())
2579  m_xAllPagesRB->set_active(true);
2580 }
2581 
2582 // example window
2584  : bHorz(false)
2585  , bVert(false)
2586  , bGraphic(false)
2587 {
2588 }
2589 
2591 {
2592  CustomWidgetController::SetDrawingArea(pDrawingArea);
2593  Size aSize = pDrawingArea->get_ref_device().LogicToPixel(Size(127 , 66), MapMode(MapUnit::MapAppFont));
2594  set_size_request(aSize.Width(), aSize.Height());
2595  SetOutputSizePixel(aSize);
2596 }
2597 
2599 {
2600  // Setup
2601  rRenderContext.SetBackground();
2602  // #i119307# the graphic might have transparency, set up white as the color
2603  // to use when drawing a rectangle under the image
2604  rRenderContext.SetLineColor(COL_WHITE);
2605  rRenderContext.SetFillColor(COL_WHITE);
2606 
2607  // Paint
2608  Point aPntPos;
2609  Size aPntSz(GetOutputSizePixel());
2610  Size aGrfSize;
2611  if (bGraphic)
2612  aGrfSize = ::GetGraphicSizeTwip(aGraphic, &rRenderContext);
2613  //it should show the default bitmap also if no graphic can be found
2614  if (!aGrfSize.Width() && !aGrfSize.Height())
2615  aGrfSize = rRenderContext.PixelToLogic(aBmp.GetSizePixel());
2616 
2617  tools::Long nRelGrf = aGrfSize.Width() * 100 / aGrfSize.Height();
2618  tools::Long nRelWin = aPntSz.Width() * 100 / aPntSz.Height();
2619  if (nRelGrf < nRelWin)
2620  {
2621  const tools::Long nWidth = aPntSz.Width();
2622  // if we use a replacement preview, try to draw at original size
2623  if (!bGraphic && (aGrfSize.Width() <= aPntSz.Width())
2624  && (aGrfSize.Height() <= aPntSz.Height()))
2625  {
2626  const tools::Long nHeight = aPntSz.Height();
2627  aPntSz.setWidth( aGrfSize.Width() );
2628  aPntSz.setHeight( aGrfSize.Height() );
2629  aPntPos.AdjustY((nHeight - aPntSz.Height()) / 2 );
2630  }
2631  else
2632  aPntSz.setWidth( aPntSz.Height() * nRelGrf /100 );
2633 
2634  aPntPos.AdjustX(nWidth - aPntSz.Width() ) ;
2635  }
2636 
2637  // #i119307# clear window background, the graphic might have transparency
2638  rRenderContext.DrawRect(tools::Rectangle(aPntPos, aPntSz));
2639 
2640  if (bHorz || bVert)
2641  {
2642  BitmapEx aTmpBmp(bGraphic ? aGraphic.GetBitmapEx() : aBmp);
2643  BmpMirrorFlags nMirrorFlags(BmpMirrorFlags::NONE);
2644  if (bHorz)
2645  nMirrorFlags |= BmpMirrorFlags::Vertical;
2646  if (bVert)
2647  nMirrorFlags |= BmpMirrorFlags::Horizontal;
2648  aTmpBmp.Mirror(nMirrorFlags);
2649  rRenderContext.DrawBitmapEx(aPntPos, aPntSz, aTmpBmp);
2650  }
2651  else if (bGraphic) //draw unmirrored preview graphic
2652  {
2653  aGraphic.Draw(rRenderContext, aPntPos, aPntSz);
2654  }
2655  else //draw unmirrored stock sample image
2656  {
2657  rRenderContext.DrawBitmapEx(aPntPos, aPntSz, aBmp);
2658  }
2659 }
2660 
2662 {
2663 }
2664 
2665 void BmpWindow::SetGraphic(const Graphic& rGraphic)
2666 {
2667  aGraphic = rGraphic;
2668  Size aSize = aGraphic.GetPrefSize();
2669  bGraphic = aSize.Width() && aSize.Height();
2670  Invalidate();
2671 }
2672 
2674 {
2675  aBmp = rBmp;
2676  Invalidate();
2677 }
2678 
2679 // set URL and ImageMap at frames
2681  : SfxTabPage(pPage, pController, "modules/swriter/ui/frmurlpage.ui", "FrameURLPage", &rSet)
2682  , m_xURLED(m_xBuilder->weld_entry("url"))
2683  , m_xSearchPB(m_xBuilder->weld_button("search"))
2684  , m_xNameED(m_xBuilder->weld_entry("name"))
2685  , m_xFrameCB(m_xBuilder->weld_combo_box("frame"))
2686  , m_xServerCB(m_xBuilder->weld_check_button("server"))
2687  , m_xClientCB(m_xBuilder->weld_check_button("client"))
2688 {
2689  m_xSearchPB->connect_clicked(LINK(this, SwFrameURLPage, InsertFileHdl));
2690 }
2691 
2693 {
2694 }
2695 
2697 {
2698  const SfxPoolItem* pItem;
2699  if ( SfxItemState::SET == rSet->GetItemState( SID_DOCFRAME, true, &pItem))
2700  {
2701  TargetList aList;
2703  size_t nCount = aList.size();
2704  for (size_t i = 0; i < nCount; ++i)
2705  {
2706  m_xFrameCB->append_text(aList.at(i));
2707  }
2708  }
2709 
2710  if ( SfxItemState::SET == rSet->GetItemState( RES_URL, true, &pItem ) )
2711  {
2712  const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem);
2713  m_xURLED->set_text(INetURLObject::decode(pFormatURL->GetURL(),
2715  m_xNameED->set_text(pFormatURL->GetName());
2716 
2717  m_xClientCB->set_sensitive(pFormatURL->GetMap() != nullptr);
2718  m_xClientCB->set_active(pFormatURL->GetMap() != nullptr);
2719  m_xServerCB->set_active(pFormatURL->IsServerMap());
2720 
2721  m_xFrameCB->set_entry_text(pFormatURL->GetTargetFrameName());
2722  m_xFrameCB->save_value();
2723  }
2724  else
2725  m_xClientCB->set_sensitive(false);
2726 
2727  m_xServerCB->save_state();
2728  m_xClientCB->save_state();
2729 }
2730 
2732 {
2733  bool bModified = false;
2734  const SwFormatURL* pOldURL = GetOldItem(*rSet, RES_URL);
2735  std::unique_ptr<SwFormatURL> pFormatURL;
2736  if(pOldURL)
2737  pFormatURL.reset(pOldURL->Clone());
2738  else
2739  pFormatURL.reset(new SwFormatURL());
2740 
2741  {
2742  const OUString sText = m_xURLED->get_text();
2743 
2744  if( pFormatURL->GetURL() != sText ||
2745  pFormatURL->GetName() != m_xNameED->get_text() ||
2746  m_xServerCB->get_active() != pFormatURL->IsServerMap() )
2747  {
2748  pFormatURL->SetURL(sText, m_xServerCB->get_active());
2749  pFormatURL->SetName(m_xNameED->get_text());
2750  bModified = true;
2751  }
2752  }
2753 
2754  if (!m_xClientCB->get_active() && pFormatURL->GetMap() != nullptr)
2755  {
2756  pFormatURL->SetMap(nullptr);
2757  bModified = true;
2758  }
2759 
2760  if(pFormatURL->GetTargetFrameName() != m_xFrameCB->get_active_text())
2761  {
2762  pFormatURL->SetTargetFrameName(m_xFrameCB->get_active_text());
2763  bModified = true;
2764  }
2765  rSet->Put(*pFormatURL);
2766  return bModified;
2767 }
2768 
2769 std::unique_ptr<SfxTabPage> SwFrameURLPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
2770 {
2771  return std::make_unique<SwFrameURLPage>(pPage, pController, *rSet);
2772 }
2773 
2775 {
2776  FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
2777  FileDialogFlags::NONE, GetFrameWeld());
2778  uno::Reference < ui::dialogs::XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
2779 
2780  try
2781  {
2782  const OUString sTemp(m_xURLED->get_text());
2783  if(!sTemp.isEmpty())
2784  xFP->setDisplayDirectory(sTemp);
2785  }
2786  catch( const uno::Exception& ) {}
2787  if( aDlgHelper.Execute() == ERRCODE_NONE )
2788  {
2789  m_xURLED->set_text(xFP->getSelectedFiles().getConstArray()[0]);
2790  }
2791 }
2792 
2794  : SfxTabPage(pPage, pController, "modules/swriter/ui/frmaddpage.ui", "FrameAddPage", &rSet)
2795  , m_pWrtSh(nullptr)
2796  , m_bHtmlMode(false)
2797  , m_bFormat(false)
2798  , m_bNew(false)
2799  , m_xNameFrame(m_xBuilder->weld_widget("nameframe"))
2800  , m_xNameFT(m_xBuilder->weld_label("name_label"))
2801  , m_xNameED(m_xBuilder->weld_entry("name"))
2802  , m_xAltNameFT(m_xBuilder->weld_label("altname_label"))
2803  , m_xAltNameED(m_xBuilder->weld_entry("altname"))
2804  , m_xDescriptionFT(m_xBuilder->weld_label("description_label"))
2805  , m_xDescriptionED(m_xBuilder->weld_text_view("description"))
2806  , m_xPrevFT(m_xBuilder->weld_label("prev_label"))
2807  , m_xPrevLB(m_xBuilder->weld_combo_box("prev"))
2808  , m_xNextFT(m_xBuilder->weld_label("next_label"))
2809  , m_xNextLB(m_xBuilder->weld_combo_box("next"))
2810  , m_xProtectFrame(m_xBuilder->weld_widget("protect"))
2811  , m_xProtectContentCB(m_xBuilder->weld_check_button("protectcontent"))
2812  , m_xProtectFrameCB(m_xBuilder->weld_check_button("protectframe"))
2813  , m_xProtectSizeCB(m_xBuilder->weld_check_button("protectsize"))
2814  , m_xContentAlignFrame(m_xBuilder->weld_widget("contentalign"))
2815  , m_xVertAlignLB(m_xBuilder->weld_combo_box("vertalign"))
2816  , m_xPropertiesFrame(m_xBuilder->weld_widget("properties"))
2817  , m_xEditInReadonlyCB(m_xBuilder->weld_check_button("editinreadonly"))
2818  , m_xPrintFrameCB(m_xBuilder->weld_check_button("printframe"))
2819  , m_xTextFlowFT(m_xBuilder->weld_label("textflow_label"))
2820  , m_xTextFlowLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textflow")))
2821 {
2822  m_xTextFlowLB->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR));
2823  m_xTextFlowLB->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL));
2824  m_xTextFlowLB->append(SvxFrameDirection::Vertical_RL_TB, SvxResId(RID_SVXSTR_PAGEDIR_RTL_VERT));
2825  m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_TB, SvxResId(RID_SVXSTR_PAGEDIR_LTR_VERT));
2826  m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_BT, SvxResId(RID_SVXSTR_PAGEDIR_LTR_BTT_VERT));
2827  m_xTextFlowLB->append(SvxFrameDirection::Environment, SvxResId(RID_SVXSTR_FRAMEDIR_SUPER));
2828  m_xDescriptionED->set_size_request(-1, m_xDescriptionED->get_preferred_size().Height());
2829 }
2830 
2832 {
2833  m_xTextFlowLB.reset();
2834 }
2835 
2836 std::unique_ptr<SfxTabPage> SwFrameAddPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
2837 {
2838  return std::make_unique<SwFrameAddPage>(pPage, pController, *rSet);
2839 }
2840 
2842 {
2843  const SfxPoolItem* pItem;
2844  sal_uInt16 nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
2845  m_bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
2846  if (m_bHtmlMode)
2847  {
2848  m_xProtectFrame->hide();
2849  m_xEditInReadonlyCB->hide();
2850  m_xPrintFrameCB->hide();
2851  }
2852  if (m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog")
2853  {
2854  m_xEditInReadonlyCB->hide();
2855  if (m_bHtmlMode)
2856  {
2857  m_xPropertiesFrame->hide();
2858  }
2859  m_xContentAlignFrame->hide();
2860  }
2861 
2862  if(SfxItemState::SET == rSet->GetItemState(FN_SET_FRM_ALT_NAME, false, &pItem))
2863  {
2864  m_xAltNameED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue());
2865  m_xAltNameED->save_value();
2866  }
2867 
2868  if(SfxItemState::SET == rSet->GetItemState(FN_UNO_DESCRIPTION, false, &pItem))
2869  {
2870  m_xDescriptionED->set_text(static_cast<const SfxStringItem*>(pItem)->GetValue());
2871  m_xDescriptionED->save_value();
2872  }
2873 
2874  if(!m_bFormat)
2875  {
2876  // insert graphic - properties
2877  // bNew is not set, so recognise by selection
2878  OUString aTmpName1;
2879  if(SfxItemState::SET == rSet->GetItemState(FN_SET_FRM_NAME, false, &pItem))
2880  {
2881  aTmpName1 = static_cast<const SfxStringItem*>(pItem)->GetValue();
2882  }
2883 
2884  OSL_ENSURE(m_pWrtSh, "no Shell?");
2885  if( m_bNew || aTmpName1.isEmpty() )
2886  {
2887  if (m_sDlgType == "PictureDialog")
2888  aTmpName1 = m_pWrtSh->GetUniqueGrfName();
2889  else if (m_sDlgType == "ObjectDialog")
2890  aTmpName1 = m_pWrtSh->GetUniqueOLEName();
2891  else
2892  aTmpName1 = m_pWrtSh->GetUniqueFrameName();
2893 
2894  m_pWrtSh->SetFlyName(aTmpName1);
2895  }
2896 
2897  m_xNameED->set_text( aTmpName1 );
2898  m_xNameED->save_value();
2899  }
2900  else
2901  {
2902  m_xNameED->set_sensitive( false );
2903  m_xAltNameED->set_sensitive(false);
2904  m_xNameFT->set_sensitive( false );
2905  m_xAltNameFT->set_sensitive(false);
2906  }
2907  if (m_sDlgType == "FrameDialog" && m_xAltNameFT->get_visible())
2908  {
2909  m_xAltNameFT->hide();
2910  m_xAltNameED->hide();
2911  }
2912  else
2913  {
2914  m_xNameED->connect_changed(LINK(this, SwFrameAddPage, EditModifyHdl));
2915  }
2916 
2917  if (!m_bNew)
2918  {
2920 
2921  if (pFormat)
2922  {
2923  const SwFormatChain &rChain = pFormat->GetChain();
2924  const SwFlyFrameFormat* pFlyFormat;
2925  OUString sNextChain, sPrevChain;
2926  pFlyFormat = rChain.GetPrev();
2927  if (pFlyFormat != nullptr)
2928  {
2929  sPrevChain = pFlyFormat->GetName();
2930  }
2931 
2932  pFlyFormat = rChain.GetNext();
2933  if (pFlyFormat != nullptr)
2934  {
2935  sNextChain = pFlyFormat->GetName();
2936  }
2937  //determine chainable frames
2938  std::vector< OUString > aPrevPageFrames;
2939  std::vector< OUString > aThisPageFrames;
2940  std::vector< OUString > aNextPageFrames;
2941  std::vector< OUString > aRemainFrames;
2942  m_pWrtSh->GetConnectableFrameFormats(*pFormat, sNextChain, false,
2943  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
2944  for (sal_Int32 nEntry = m_xPrevLB->get_count(); nEntry > 1; nEntry--)
2945  m_xPrevLB->remove(nEntry - 1);
2946  lcl_InsertVectors(*m_xPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
2947  if(!sPrevChain.isEmpty())
2948  {
2949  if (m_xPrevLB->find_text(sPrevChain) == -1)
2950  m_xPrevLB->insert_text(1, sPrevChain);
2951  m_xPrevLB->set_active_text(sPrevChain);
2952  }
2953  else
2954  m_xPrevLB->set_active(0);
2955  aPrevPageFrames.clear();
2956  aNextPageFrames.clear();
2957  aThisPageFrames.clear();
2958  aRemainFrames.clear();
2959 
2960  m_pWrtSh->GetConnectableFrameFormats(*pFormat, sPrevChain, true,
2961  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
2962  for (sal_Int32 nEntry = m_xNextLB->get_count(); nEntry > 1; nEntry--)
2963  m_xNextLB->remove(nEntry - 1);
2964  lcl_InsertVectors(*m_xNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
2965  if(!sNextChain.isEmpty())
2966  {
2967  if (m_xNextLB->find_text(sNextChain) == -1)
2968  m_xNextLB->insert_text(1, sNextChain);
2969  m_xNextLB->set_active_text(sNextChain);
2970  }
2971  else
2972  m_xNextLB->set_active(0);
2973  Link<weld::ComboBox&,void> aLink(LINK(this, SwFrameAddPage, ChainModifyHdl));
2974  m_xPrevLB->connect_changed(aLink);
2975  m_xNextLB->connect_changed(aLink);
2976  }
2977  }
2978  // Pos Protected
2979  const SvxProtectItem& rProt = rSet->Get(RES_PROTECT);
2980  m_xProtectFrameCB->set_active(rProt.IsPosProtected());
2981  m_xProtectContentCB->set_active(rProt.IsContentProtected());
2982  m_xProtectSizeCB->set_active(rProt.IsSizeProtected());
2983 
2985  m_xEditInReadonlyCB->set_active(rEdit.GetValue());
2986  m_xEditInReadonlyCB->save_state();
2987 
2988  // print
2989  const SvxPrintItem& rPrt = rSet->Get(RES_PRINT);
2990  m_xPrintFrameCB->set_active(rPrt.GetValue());
2991  m_xPrintFrameCB->save_state();
2992 
2993  // textflow
2994  if( (!m_bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES)))
2995  && m_sDlgType != "PictureDialog" && m_sDlgType != "ObjectDialog"
2996  && SfxItemState::UNKNOWN != rSet->GetItemState( RES_FRAMEDIR ) )
2997  {
2998  m_xTextFlowFT->show();
2999  m_xTextFlowLB->show();
3000 
3001  //vertical text flow is not possible in HTML
3002  if(m_bHtmlMode)
3003  {
3004  m_xTextFlowLB->remove_id(SvxFrameDirection::Vertical_RL_TB);
3005  }
3006  SvxFrameDirection nVal = rSet->Get(RES_FRAMEDIR).GetValue();
3007  m_xTextFlowLB->set_active_id(nVal);
3008  m_xTextFlowLB->save_value();
3009  }
3010  else
3011  {
3012  m_xTextFlowFT->hide();
3013  m_xTextFlowLB->hide();
3014  }
3015 
3016  // Content alignment
3017  if ( rSet->GetItemState(RES_TEXT_VERT_ADJUST) > SfxItemState::DEFAULT )
3018  {
3019  SdrTextVertAdjust nAdjust = rSet->Get(RES_TEXT_VERT_ADJUST).GetValue();
3020  sal_Int32 nPos = 0;
3021  switch(nAdjust)
3022  {
3023  case SDRTEXTVERTADJUST_TOP: nPos = 0; break;
3025  case SDRTEXTVERTADJUST_BLOCK: nPos = 1; break;
3026  case SDRTEXTVERTADJUST_BOTTOM: nPos = 2; break;
3027  }
3028  m_xVertAlignLB->set_active(nPos);
3029  }
3030  m_xVertAlignLB->save_value();
3031 }
3032 
3034 {
3035  bool bRet = false;
3036  if (m_xNameED->get_value_changed_from_saved())
3037  bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_NAME, m_xNameED->get_text()));
3038  if (m_xAltNameED->get_value_changed_from_saved())
3039  bRet |= nullptr != rSet->Put(SfxStringItem(FN_SET_FRM_ALT_NAME, m_xAltNameED->get_text()));
3040  if (m_xDescriptionED->get_value_changed_from_saved())
3041  bRet |= nullptr != rSet->Put(SfxStringItem(FN_UNO_DESCRIPTION, m_xDescriptionED->get_text()));
3042 
3043  const SfxPoolItem* pOldItem;
3045  aProt.SetContentProtect( m_xProtectContentCB->get_active() );
3046  aProt.SetSizeProtect ( m_xProtectSizeCB->get_active() );
3047  aProt.SetPosProtect ( m_xProtectFrameCB->get_active() );
3048  if ( nullptr == (pOldItem = GetOldItem(*rSet, FN_SET_PROTECT)) ||
3049  aProt != *pOldItem )
3050  bRet |= nullptr != rSet->Put( aProt);
3051 
3052  if ( m_xEditInReadonlyCB->get_state_changed_from_saved() )
3053  bRet |= nullptr != rSet->Put( SwFormatEditInReadonly( RES_EDIT_IN_READONLY, m_xEditInReadonlyCB->get_active()));
3054 
3055  if ( m_xPrintFrameCB->get_state_changed_from_saved() )
3056  bRet |= nullptr != rSet->Put( SvxPrintItem( RES_PRINT, m_xPrintFrameCB->get_active()));
3057 
3058  // textflow
3059  if (m_xTextFlowLB->get_visible() && m_xTextFlowLB->get_value_changed_from_saved())
3060  {
3061  SvxFrameDirection eDirection = m_xTextFlowLB->get_active_id();
3062  bRet |= nullptr != rSet->Put( SvxFrameDirectionItem(eDirection, RES_FRAMEDIR ));
3063  }
3064  if(m_pWrtSh)
3065  {
3066  const SwFrameFormat* pFormat = m_pWrtSh->GetFlyFrameFormat();
3067  if (pFormat)
3068  {
3069  OUString sCurrentPrevChain, sCurrentNextChain;
3070  if (m_xPrevLB->get_active())
3071  sCurrentPrevChain = m_xPrevLB->get_active_text();
3072  if (m_xNextLB->get_active())
3073  sCurrentNextChain = m_xNextLB->get_active_text();
3074  const SwFormatChain &rChain = pFormat->GetChain();
3075  const SwFlyFrameFormat* pFlyFormat;
3076  OUString sNextChain, sPrevChain;
3077  pFlyFormat = rChain.GetPrev();
3078  if (pFlyFormat != nullptr)
3079  sPrevChain = pFlyFormat->GetName();
3080 
3081  pFlyFormat = rChain.GetNext();
3082  if (pFlyFormat != nullptr)
3083  sNextChain = pFlyFormat->GetName();
3084  if(sPrevChain != sCurrentPrevChain)
3085  bRet |= nullptr != rSet->Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS, sCurrentPrevChain));
3086  if(sNextChain != sCurrentNextChain)
3087  bRet |= nullptr != rSet->Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain));
3088  }
3089  }
3090 
3091  if (m_xVertAlignLB->get_value_changed_from_saved())
3092  {
3093  SdrTextVertAdjust nAdjust;
3094  switch (m_xVertAlignLB->get_active())
3095  {
3096  default:
3097  case 0 : nAdjust = SDRTEXTVERTADJUST_TOP; break;
3098  case 1 : nAdjust = SDRTEXTVERTADJUST_CENTER; break;
3099  case 2 : nAdjust = SDRTEXTVERTADJUST_BOTTOM; break;
3100  }
3101  bRet |= nullptr != rSet->Put(SdrTextVertAdjustItem(nAdjust, RES_TEXT_VERT_ADJUST));
3102  }
3103 
3104  return bRet;
3105 }
3106 
3108 {
3109  bool bEnable = !m_xNameED->get_text().isEmpty();
3110  m_xAltNameED->set_sensitive(bEnable);
3111  m_xAltNameFT->set_sensitive(bEnable);
3112 }
3113 
3114 void SwFrameAddPage::SetFormatUsed(bool bFormatUsed)
3115 {
3116  m_bFormat = bFormatUsed;
3117  if (m_bFormat)
3118  {
3119  m_xNameFrame->hide();
3120  }
3121 }
3122 
3123 IMPL_LINK(SwFrameAddPage, ChainModifyHdl, weld::ComboBox&, rBox, void)
3124 {
3125  OUString sCurrentPrevChain, sCurrentNextChain;
3126  if (m_xPrevLB->get_active())
3127  sCurrentPrevChain = m_xPrevLB->get_active_text();
3128  if (m_xNextLB->get_active())
3129  sCurrentNextChain = m_xNextLB->get_active_text();
3130  SwFrameFormat* pFormat = m_pWrtSh->GetFlyFrameFormat();
3131  if (!pFormat)
3132  return;
3133 
3134  bool bNextBox = m_xNextLB.get() == &rBox;
3135  weld::ComboBox& rChangeLB = bNextBox ? *m_xPrevLB : *m_xNextLB;
3136  for (sal_Int32 nEntry = rChangeLB.get_count(); nEntry > 1; nEntry--)
3137  rChangeLB.remove(nEntry - 1);
3138  //determine chainable frames
3139  std::vector< OUString > aPrevPageFrames;
3140  std::vector< OUString > aThisPageFrames;
3141  std::vector< OUString > aNextPageFrames;
3142  std::vector< OUString > aRemainFrames;
3143  m_pWrtSh->GetConnectableFrameFormats(*pFormat, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
3144  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
3145  lcl_InsertVectors(rChangeLB,
3146  aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
3147  const OUString sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
3148  if (rChangeLB.find_text(sToSelect) != -1)
3149  rChangeLB.set_active_text(sToSelect);
3150  else
3151  rChangeLB.set_active(0);
3152 
3153 }
3154 
3155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: frmpage.cxx:1698
bool GetValue() const
FrameMap const aHCharHtmlMap[]
Definition: frmpage.cxx:313
#define SO3_SM_CLASSID_60
std::unique_ptr< weld::Label > m_xAtVertPosFT
Definition: frmpage.hxx:113
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
void SetFlyName(const OUString &rName)
Set name at selected FlyFrame.
Definition: fefly1.cxx:1473
std::unique_ptr< weld::CheckButton > m_xEditInReadonlyCB
Definition: frmpage.hxx:297
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
tools::Long GetWidth() const
#define FN_HORI_ORIENT
Definition: cmdid.h:854
constexpr auto VERT_PARA_REL
Definition: frmpage.cxx:282
FrameMap const * m_pHMap
Definition: frmpage.hxx:69
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
std::unique_ptr< weld::Label > m_xVerticalFT
Definition: frmpage.hxx:111
FieldUnit
SDRTEXTVERTADJUST_TOP
FrameMap const aHFrameMap[]
Definition: frmpage.cxx:223
sal_Int32 nIndex
FrameMap const aVCharHtmlAbsMap[]
Definition: frmpage.cxx:354
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:2341
std::unique_ptr< weld::CustomWeld > m_xCtlAngleWin
Definition: frmpage.hxx:221
std::unique_ptr< svx::DialControl > m_xCtlAngle
Definition: frmpage.hxx:220
std::unique_ptr< weld::RadioButton > m_xAnchorAsCharRB
Definition: frmpage.hxx:98
std::unique_ptr< weld::Widget > m_xContentAlignFrame
Definition: frmpage.hxx:293
void SetWidthPercentRelation(sal_Int16 n)
Definition: fmtfsize.hxx:96
std::unique_ptr< weld::RadioButton > m_xLeftPagesRB
Definition: frmpage.hxx:210
bool m_bAllowVertPositioning
Definition: frmpage.hxx:71
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(98)
sal_uInt16 GetLower() const
void SetHeight(tools::Long n)
static const WhichRangesContainer aAddPgRg
Definition: frmpage.hxx:305
FrameMap const aHPageMap[]
Definition: frmpage.cxx:191
void EnableVerticalPositioning(bool bEnable)
Definition: frmpage.cxx:2291
OUString aFilterName
Definition: frmpage.hxx:197
constexpr auto HORI_PARA_REL
Definition: frmpage.cxx:255
void setWidth(tools::Long nWidth)
OUString m_sDlgType
Definition: frmpage.hxx:271
FrameMap const aVPageMap[]
Definition: frmpage.cxx:206
std::unique_ptr< weld::Label > m_xAtHorzPosFT
Definition: frmpage.hxx:104
virtual SwFormatURL * Clone(SfxItemPool *pPool=nullptr) const override
Definition: atrfrm.cxx:1829
#define FN_PARAM_CHAIN_PREVIOUS
Definition: cmdid.h:819
static constexpr auto Items
static void GetDefaultTargetList(TargetList &)
void SetGrfToggle(bool bNew)
Definition: grfatr.hxx:66
std::unique_ptr< weld::CheckButton > m_xProtectSizeCB
Definition: frmpage.hxx:291
constexpr TypedWhichId< SwFormatEditInReadonly > RES_EDIT_IN_READONLY(112)
std::string GetValue
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
std::unique_ptr< weld::Label > m_xLabelGraphicType
Definition: frmpage.hxx:225
void FitToActualSize(SwFormatCol &rCol, sal_uInt16 nWidth)
Definition: colmgr.cxx:35
void SetFormatUsed(bool bFormat)
Definition: frmpage.cxx:2284
void EnableGraficMode()
Definition: frmpage.cxx:837
#define FN_PARAM_GRF_CONNECT
Definition: cmdid.h:785
void append_separator(const OUString &rId)
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
FrameMap const aVFlyHtmlMap[]
Definition: frmpage.cxx:248
bool m_bIsInRightToLeft
Definition: frmpage.hxx:49
std::unique_ptr< weld::CheckButton > m_xPrintFrameCB
Definition: frmpage.hxx:298
GPOS_LT
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
int n1
std::unique_ptr< weld::ComboBox > m_xRelWidthRelationLB
Definition: frmpage.hxx:81
sal_Int16 m_nOldVRel
Definition: frmpage.hxx:66
std::unique_ptr< weld::ComboBox > m_xNextLB
Definition: frmpage.hxx:286
constexpr TypedWhichId< SdrTextVertAdjustItem > RES_TEXT_VERT_ADJUST(130)
#define MINFLY
Definition: swtypes.hxx:62
SwTwips GetPos() const
Definition: fmtornt.hxx:92
sal_uIntPtr sal_uLong
long Long
FrameMap const aVCharHtmlMap[]
Definition: frmpage.cxx:349
static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, bool bVertical, bool bVerticalL2R, bool bRTL)
Definition: frmpage.cxx:479
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:2696
#define FN_OLE_IS_MATH
Definition: cmdid.h:619
#define FN_SET_FRM_ALT_NAME
Definition: cmdid.h:858
SwWrtShell * GetActiveWrtShell()
Definition: swmodul1.cxx:108
FrameMap const aHParaHtmlAbsMap[]
Definition: frmpage.cxx:275
virtual int find_text(const OUString &rStr) const =0
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:859
#define HTML_HORI_PARA_REL
Definition: frmpage.cxx:267
sal_Int16 m_nOldHRel
Definition: frmpage.hxx:64
std::unique_ptr< weld::Label > m_xHoriRelationFT
Definition: frmpage.hxx:106
const SwPosition * mpToCharContentPos
Definition: frmpage.hxx:60
SDRTEXTVERTADJUST_BLOCK
MirrorGraph
Definition: grfatr.hxx:31
void Draw(OutputDevice &rOutDev, const Point &rDestPt) const
SwFrameAddPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:2793
SvxFrameDirection
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
bool GetGrfSize(Size &) const
Definition: editsh.cxx:279
std::unique_ptr< weld::Button > m_xRealSizeBT
Definition: frmpage.hxx:91
static SfxObjectShell * Current()
void append(const OUString &rId, const OUString &rStr)
static sal_Int16 GetRelation(const weld::ComboBox &rRelationLB)
Definition: frmpage.cxx:1583
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool IsSizeProtected() const
SwFramePage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:620
virtual OUString get_active_id() const =0
std::unique_ptr< weld::CheckButton > m_xProtectContentCB
Definition: frmpage.hxx:289
sal_uInt16 m_nHtmlMode
Definition: frmpage.hxx:51
std::unique_ptr< weld::Button > m_xBrowseBT
Definition: frmpage.hxx:214
FrameMap const aHParaHtmlMap[]
Definition: frmpage.cxx:269
std::unique_ptr< weld::Label > m_xHeightFT
Definition: frmpage.hxx:84
SwFrameExample m_aExampleWN
Definition: frmpage.hxx:75
virtual int get_active() const =0
std::unique_ptr< weld::Label > m_xHeightAutoFT
Definition: frmpage.hxx:85
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
std::unique_ptr< weld::Entry > m_xNameED
Definition: frmpage.hxx:248
Value in Var-direction gives minimum (can be exceeded but not be less).
std::unique_ptr< weld::Widget > m_xPropertiesFrame
Definition: frmpage.hxx:296
virtual int get_count() const =0
Size const & GetOutputSizePixel() const
bool m_bHtmlMode
Definition: frmpage.hxx:50
std::unique_ptr< weld::Entry > m_xNameED
Definition: frmpage.hxx:278
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
constexpr tools::Long Width() const
#define FN_VERT_ORIENT
Definition: cmdid.h:853
std::unique_ptr< weld::ComboBox > m_xVertAlignLB
Definition: frmpage.hxx:294
std::unique_ptr< SwPercentField > m_xHeightED
Definition: frmpage.hxx:124
std::unique_ptr< SwPercentField > m_xWidthED
Definition: frmpage.hxx:123
bool m_bHtmlMode
Definition: frmpage.hxx:272
FrameMap const aHFlyHtmlMap[]
Definition: frmpage.cxx:231
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
FrameMap const aHCharHtmlAbsMap[]
Definition: frmpage.cxx:319
FrameMap const aVPageHtmlMap[]
Definition: frmpage.cxx:214
void SetBackground()
std::unique_ptr< weld::MetricSpinButton > m_xNfAngle
Definition: frmpage.hxx:219
void SetVertRel(short nR)
const SwView & GetView() const
Definition: wrtsh.hxx:431
std::unique_ptr< weld::CheckButton > m_xMirrorPagesCB
Definition: frmpage.hxx:109
int n2
const SwFrameFormat * IsFlyInFly()
Is selected frame within another frame?
Definition: fefly1.cxx:312
NONE
bool m_bAtVertPosModified
Definition: frmpage.hxx:41
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
void RangeModifyHdl()
Definition: frmpage.cxx:1757
RelationMap const aAsCharRelationMap[]
Definition: frmpage.cxx:180
IMPL_LINK(SwFramePage, RelSizeClickHdl, weld::Toggleable &, rBtn, void)
Definition: frmpage.cxx:1726
SwWrtShell * m_pWrtSh
Definition: frmpage.hxx:269
bool m_bFormat
Definition: frmpage.hxx:43
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:2841
#define VERT_PAGE_REL
Definition: frmpage.cxx:204
std::unique_ptr< weld::Label > m_xVertRelationFT
Definition: frmpage.hxx:115
Graphic aGraphic
Definition: bmpwin.hxx:31
std::unique_ptr< weld::CheckButton > m_xClientCB
Definition: frmpage.hxx:253
const OUString & GetName() const
Definition: format.hxx:115
void SetExchangeSupport()
int nCount
OUString SvxResId(TranslateId aId)
void set_accessible_name(const OUString &rName)
RndStdIds GetAnchor() const
Definition: frmpage.cxx:1661
void UpdateExample()
Definition: frmpage.cxx:2073
const Graphic * GetGraphic(OUString const &referer=OUString()) const
static OUString GetString(StringId eId)
virtual OutputDevice & get_ref_device()=0
std::unique_ptr< weld::CheckButton > m_xRelHeightCB
Definition: frmpage.hxx:86
#define HTML_HORI_CHAR_REL
Definition: frmpage.cxx:311
virtual ~SwGrfExtPage() override
Definition: frmpage.cxx:2333
bool bHorz
Definition: bmpwin.hxx:34
void SetVAlign(short nV)
void DrawRect(const tools::Rectangle &rRect)
std::unique_ptr< weld::MetricSpinButton > m_xAtVertPosED
Definition: frmpage.hxx:114
const OUString & GetName() const
Definition: fmturl.hxx:71
#define FN_PARAM_GRF_REALSIZE
Definition: cmdid.h:790
const SfxItemSet & GetItemSet() const
std::unique_ptr< weld::Label > m_xNameFT
Definition: frmpage.hxx:277
#define SAL_N_ELEMENTS(arr)
void Init(const SfxItemSet &rSet)
Definition: frmpage.cxx:2100
void SetHeightPercentRelation(sal_Int16 n)
Definition: fmtfsize.hxx:94
static ErrCode LoadGraphic(const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
exports com.sun.star. text
virtual ~SwFramePage() override
Definition: frmpage.cxx:727
BitmapEx aBmp
Definition: bmpwin.hxx:32
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
#define FN_UNO_DESCRIPTION
Definition: cmdid.h:860
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
SDRTEXTVERTADJUST_BOTTOM
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:2731
#define SO3_SM_CLASSID_50
void SetLineColor()
void set_active_text(const OUString &rStr)
std::unique_ptr< weld::Button > m_xSearchPB
Definition: frmpage.hxx:247
Style of a layout element.
Definition: frmfmt.hxx:59
void SetFormatUsed(bool bFormat)
Definition: frmpage.cxx:3114
virtual ~SwFrameAddPage() override
Definition: frmpage.cxx:2831
Size m_aGrfSize
Definition: frmpage.hxx:53
Only protection that cannot be withdrawn e.g.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:763
int i
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
#define FN_KEEP_ASPECT_RATIO
Definition: cmdid.h:856
virtual ~BmpWindow() override
Definition: frmpage.cxx:2661
FrameMap const aVParaMap[]
Definition: frmpage.cxx:285
GraphicType GetType() const
SvxSwFramePosString::StringId eMirrorStrId
Definition: frmpage.cxx:148
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: frmpage.cxx:2373
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
virtual void Reset(const SfxItemSet *rSet) override
Definition: frmpage.cxx:2346
bool m_bHtmlMode
Definition: frmpage.hxx:202
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
bool IsInGraficMode() const
Definition: frmpage.hxx:191
SW_DLLPUBLIC void InsertStringSorted(const OUString &rId, const OUString &rEntry, weld::ComboBox &rToFill, int nOffset)
Definition: uitool.cxx:775
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
std::unique_ptr< weld::CheckButton > m_xProtectFrameCB
Definition: frmpage.hxx:290
void GetConnectableFrameFormats(SwFrameFormat &rFormat, const OUString &rReference, bool bSuccessors, std::vector< OUString > &aPrevPageVec, std::vector< OUString > &aThisPageVec, std::vector< OUString > &aNextPageVec, std::vector< OUString > &aRestVec)
Definition: fefly1.cxx:1868
sal_uInt16 GetPhyPageNum() const
Phy: real page count.
Definition: fews.cxx:335
std::unique_ptr< weld::Label > m_xHorizontalFT
Definition: frmpage.hxx:102
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:3033
FrameMap const aHParaMap[]
Definition: frmpage.cxx:259
FrameMap const aHCharMap[]
Definition: frmpage.cxx:303
static sal_Int16 GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, const weld::ComboBox &rRelationLB)
Definition: frmpage.cxx:1595
svt::EmbeddedObjectRef & GetOLEObject() const
Get OLE object at pointer.
Definition: editsh.cxx:359
const OUString & GetValue() const
FlyAnchors.
Definition: fmtanchr.hxx:34
bool m_bNew
Definition: frmpage.hxx:44
std::unique_ptr< weld::Label > m_xWidthAutoFT
Definition: frmpage.hxx:79
HTMLMODE_ON
void SetWidthSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:84
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:354
LB nLBRelations
Definition: frmpage.cxx:150
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
#define FN_SET_PROTECT
Definition: cmdid.h:851
std::unique_ptr< svx::FrameDirectionListBox > m_xTextFlowLB
Definition: frmpage.hxx:300
void MirrorHorz(bool bMirror)
Definition: bmpwin.hxx:46
bool bGraphic
Definition: bmpwin.hxx:36
std::unique_ptr< weld::Entry > m_xURLED
Definition: frmpage.hxx:246
void SetFillColor()
bool m_bIsMathBaselineAlignment
Definition: frmpage.hxx:73
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::unique_ptr< weld::Label > m_xWidthFT
Definition: frmpage.hxx:78
std::unique_ptr< weld::CheckButton > m_xFixedRatioCB
Definition: frmpage.hxx:90
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:832
std::unique_ptr< weld::Label > m_xAltNameFT
Definition: frmpage.hxx:279
std::unique_ptr< weld::CheckButton > m_xMirrorVertBox
Definition: frmpage.hxx:207
static LB lcl_GetLBRelationsForStrID(const FrameMap *_pMap, const SvxSwFramePosString::StringId _eStrId, const bool _bUseMirrorStr)
Definition: frmpage.cxx:589
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
std::unique_ptr< weld::CheckButton > m_xAutoHeightCB
Definition: frmpage.hxx:88
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: frmpage.cxx:2513
bool IsContentProtected() const
FrameMap const aVAsCharHtmlMap[]
Definition: frmpage.cxx:378
std::unique_ptr< weld::CheckButton > m_xFollowTextFlowCB
Definition: frmpage.hxx:118
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
SwFrameSize
Definition: fmtfsize.hxx:35
void setOptimalFrameWidth()
Definition: frmpage.cxx:740
SwFrameURLPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:2680
void SetHAlign(short nH)
virtual void set_active(int pos)=0
std::unique_ptr< weld::Entry > m_xConnectED
Definition: frmpage.hxx:213
#define FN_MATH_BASELINE_ALIGNMENT
Definition: cmdid.h:620
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
#define MAX_PERCENT_HEIGHT
Definition: frmpage.cxx:94
virtual void clear()=0
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
OUString aGrfName
Definition: frmpage.hxx:198
std::unique_ptr< weld::Entry > m_xAltNameED
Definition: frmpage.hxx:280
tools::Long GetHeight() const
RelationMap const aRelationMap[]
Definition: frmpage.cxx:154
sal_Int16 m_nOldV
Definition: frmpage.hxx:65
OUString GetUniqueFrameName() const
Definition: feflyole.cxx:83
std::unique_ptr< weld::CheckButton > m_xRelWidthCB
Definition: frmpage.hxx:80
void SetAnchor(RndStdIds nA)
void SetOutputSizePixel(const Size &rSize)
std::unique_ptr< weld::ComboBox > m_xVerticalDLB
Definition: frmpage.hxx:112
const SfxItemSet * GetDialogExampleSet() const
Frame cannot be moved in Var-direction.
tools::Long SwTwips
Definition: swtypes.hxx:52
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2683
const long LONG_MAX
std::unique_ptr< weld::ComboBox > m_xRelHeightRelationLB
Definition: frmpage.hxx:87
SwDocShell * GetDocShell()
Definition: view.cxx:1127
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
std::unique_ptr< weld::ComboBox > m_xVertRelationLB
Definition: frmpage.hxx:116
std::unique_ptr< weld::Label > m_xTextFlowFT
Definition: frmpage.hxx:299
std::unique_ptr< weld::RadioButton > m_xAllPagesRB
Definition: frmpage.hxx:209
sal_Int32 FillPosLB(const FrameMap *_pMap, const sal_Int16 _nAlign, const sal_Int16 _nRel, weld::ComboBox &_rLB)
Definition: frmpage.cxx:1358
void SetWidth(tools::Long n)
std::unique_ptr< weld::CheckButton > m_xAutoWidthCB
Definition: frmpage.hxx:82
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: frmpage.cxx:1684
sal_Int16 GetHeightPercentRelation() const
Definition: fmtfsize.hxx:89
std::unique_ptr< weld::Widget > m_xProtectFrame
Definition: frmpage.hxx:288
bool bVert
Definition: bmpwin.hxx:35
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Size GetPrefSize() const
IMPL_LINK_NOARG(SwFramePage, MirrorHdl, weld::Toggleable &, void)
Definition: frmpage.cxx:1720
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: frmpage.cxx:2590
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
void SetHeightPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:93
#define FN_PARAM_CHAIN_NEXT
Definition: cmdid.h:820
const OUString & GetGraphicLink() const
SwGrfExtPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: frmpage.cxx:2302
std::unique_ptr< weld::CheckButton > m_xServerCB
Definition: frmpage.hxx:252
static sal_Int32 GetMapPos(const FrameMap *pMap, const weld::ComboBox &rAlignLB)
Definition: frmpage.cxx:1628
void set_size_request(int nWidth, int nHeight)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr TypedWhichId< SwMirrorGrf > RES_GRFATR_MIRRORGRF(RES_GRFATR_BEGIN)
void SetSizeProtect(bool bNew)
bool IsPosToggle() const
Definition: fmtornt.hxx:95
SfxItemState
weld::Entry & rEdit
SwTwips m_nLowerBorder
Definition: frmpage.hxx:55
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
bool IsFrameVertical(const bool bEnvironment, bool &bRightToLeft, bool &bVertL2R) const
Determines whether a frame or its environment is vertically formatted and right-to-left.
Definition: fews.cxx:1271
void SetPosProtect(bool bNew)
#define VERT_FRAME_REL
Definition: frmpage.cxx:238
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:1037
HTMLMODE_SOME_STYLES
std::unique_ptr< weld::RadioButton > m_xRightPagesRB
Definition: frmpage.hxx:211
std::unique_ptr<::sfx2::FileDialogHelper > m_xGrfDlg
Definition: frmpage.hxx:200
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static void lcl_InsertVectors(weld::ComboBox &rBox, const std::vector< OUString > &rPrev, const std::vector< OUString > &rThis, const std::vector< OUString > &rNext, const std::vector< OUString > &rRemain)
Definition: frmpage.cxx:453
FrameMap const aVAsCharMap[]
Definition: frmpage.cxx:361
#define ERRCODE_NONE
constexpr tools::Long Height() const
std::unique_ptr< weld::RadioButton > m_xAnchorAtCharRB
Definition: frmpage.hxx:97
unsigned char sal_uInt8
virtual OUString get_label() const =0
std::unique_ptr< weld::RadioButton > m_xAnchorAtPageRB
Definition: frmpage.hxx:95
SwTwips GetPos() const
Definition: fmtornt.hxx:59
SwTwips m_nUpperBorder
Definition: frmpage.hxx:54
void SetWidthPercent(sal_uInt8 n)
Definition: fmtfsize.hxx:95
const OUString & GetTargetFrameName() const
Definition: fmturl.hxx:65
bool m_bIsVerticalL2R
Definition: frmpage.hxx:48
#define FN_SET_FRM_NAME
Definition: cmdid.h:855
#define SO3_SM_CLASSID_40
#define MAX_PERCENT_WIDTH
Definition: frmpage.cxx:93
static LB lcl_GetLBRelationsForRelations(const sal_Int16 _nRel)
Definition: frmpage.cxx:572
FRAME
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
OUString GetUniqueGrfName() const
Created unique name for frame.
Definition: fefly1.cxx:1506
SwWrtShell * getFrameDlgParentShell()
Definition: frmpage.cxx:854
constexpr auto VERT_CHAR_REL
Definition: frmpage.cxx:327
std::unique_ptr< weld::Widget > m_xMirror
Definition: frmpage.hxx:206
static const WhichRangesContainer aPageRg
Definition: frmpage.hxx:176
bool m_bIsVerticalFrame
Definition: frmpage.hxx:46
double m_fWidthHeightRatio
Definition: frmpage.hxx:56
OUString aNewGrfName
Definition: frmpage.hxx:198
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
Definition: frmpage.cxx:2598
FrameMap const aVFrameMap[]
Definition: frmpage.cxx:240
constexpr auto HORI_PAGE_REL
Definition: frmpage.cxx:188
void setOptimalRelWidth()
Definition: frmpage.cxx:799
std::unique_ptr< weld::ComboBox > m_xFrameCB
Definition: frmpage.hxx:249
void SetHoriRel(short nR)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:2769
FrameMap const aVCharMap[]
Definition: frmpage.cxx:330
SfxOkDialogController * GetDialogController() const
void SetWrap(css::text::WrapTextMode nW)
ColumnDescriptor.
Definition: fmtclds.hxx:33
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
virtual OUString get_id(int pos) const =0
std::unique_ptr< weld::ComboBox > m_xHoriRelationLB
Definition: frmpage.hxx:107
FrameMap const aVParaHtmlMap[]
Definition: frmpage.cxx:293
std::unique_ptr< weld::Widget > m_xNameFrame
Definition: frmpage.hxx:276
void SetRelPos(const Point &rP)
std::unique_ptr< weld::ComboBox > m_xHorizontalDLB
Definition: frmpage.hxx:103
constexpr auto HORI_CHAR_REL
Definition: frmpage.cxx:299
DeactivateRC
void setHeight(tools::Long nHeight)
constexpr auto HORI_FRAME_REL
Definition: frmpage.cxx:220
std::unique_ptr< weld::ComboBox > m_xPrevLB
Definition: frmpage.hxx:284
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: frmpage.cxx:2836
void MirrorVert(bool bMirror)
Definition: bmpwin.hxx:45
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1272
virtual void remove(int pos)=0
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
void append_text(const OUString &rStr)
RndStdIds
OUString m_sDlgType
Definition: frmpage.hxx:52
virtual ~SwFrameURLPage() override
Definition: frmpage.cxx:2692
void SetContentProtect(bool bNew)
std::unique_ptr< weld::CustomWeld > m_xBmpWin
Definition: frmpage.hxx:222
sal_Int16 m_nOldH
Definition: frmpage.hxx:63
static OUString EraseAllMnemonicChars(const OUString &rStr)
void SetTransparent(bool bT)
sal_Int16 nAlign
Definition: frmpage.cxx:149
Frame is variable in Var-direction.
void SetGraphic(const Graphic &rGrf)
Definition: frmpage.cxx:2665
void InitPos(RndStdIds eId, sal_Int16 nH, sal_Int16 nHRel, sal_Int16 nV, sal_Int16 nVRel, tools::Long nX, tools::Long nY)
Definition: frmpage.cxx:1232
const Size & GetSizePixel() const
constexpr TypedWhichId< SwFormatFollowTextFlow > RES_FOLLOW_TEXT_FLOW(123)
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
#define SO3_SM_CLASSID_30
bool IsServerMap() const
Definition: fmturl.hxx:67
void SetHeightSizeType(SwFrameSize eSize)
Definition: fmtfsize.hxx:81
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: frmpage.cxx:2466
void FillRelLB(const FrameMap *_pMap, const sal_uInt16 _nLBSelPos, const sal_Int16 _nAlign, const sal_Int16 _nRel, weld::ComboBox &_rLB, weld::Label &_rFT)
Definition: frmpage.cxx:1412
BmpWindow m_aBmpWin
Definition: frmpage.hxx:205
std::unique_ptr< weld::CheckButton > m_xMirrorHorzBox
Definition: frmpage.hxx:208
std::unique_ptr< weld::MetricSpinButton > m_xAtHorzPosED
Definition: frmpage.hxx:105
::std::vector< OUString > TargetList
sal_Int16 GetWidthPercentRelation() const
Definition: fmtfsize.hxx:92
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
void ValidateMetrics(SvxSwFrameValidation &rVal, const SwPosition *pToCharContentPos, bool bOnlyPercentRefValue=false)
Definition: frmmgr.cxx:265
static size_t lcl_GetFrameMapCount(const FrameMap *pMap)
Definition: frmpage.cxx:404
FrameMap const aHPageHtmlMap[]
Definition: frmpage.cxx:199
FrameMap const * m_pVMap
Definition: frmpage.hxx:68
SdrTextVertAdjust
bool m_bAtHorzPosModified
Definition: frmpage.hxx:40
OUString GetUniqueOLEName() const
Definition: feflyole.cxx:78
LB
SvxSwFramePosString::StringId eStrId
Definition: frmpage.cxx:147
virtual void set_visible(bool visible)
sal_uInt16 nPos
virtual void set_sensitive(bool sensitive)=0
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
const sal_uInt32 TOP
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
void SetBitmapEx(const BitmapEx &rGrf)
Definition: frmpage.cxx:2673
bool IsPosProtected() const
sal_uInt16 GetUpper() const
virtual OUString get_active_text() const =0
static OUString GetImageType(const Graphic &rGraphic)
SDRTEXTVERTADJUST_CENTER
std::unique_ptr< weld::TextView > m_xDescriptionED
Definition: frmpage.hxx:282
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
std::unique_ptr< weld::RadioButton > m_xAnchorAtFrameRB
Definition: frmpage.hxx:99
const OUString & GetURL() const
Definition: fmturl.hxx:66
bool m_bIsMathOLE
Definition: frmpage.hxx:72
Size GetGraphicSizeTwip(const Graphic &rGraphic, vcl::RenderContext *pOutDev)
Definition: swtypes.cxx:28
bool m_bNoModifyHdl
Definition: frmpage.hxx:45
BmpMirrorFlags
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
std::unique_ptr< weld::RadioButton > m_xAnchorAtParaRB
Definition: frmpage.hxx:96