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