4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Alejandro Aguilar Sierra
9 * \author Lars Gullik Bjønnes
10 * \author Matthias Ettrich
12 * Full author contact details are available in file CREDITS.
18 #include "ColorCode.h"
19 #include "InsetCode.h"
20 #include "InsetLayout.h"
21 #include "LayoutEnums.h"
22 #include "OutputEnums.h"
23 #include "OutputParams.h"
25 #include "support/strfwd.h"
26 #include "support/types.h"
27 #include "support/FileNameList.h"
46 class InsetCollapsible;
67 namespace graphics { class PreviewLoader; }
70 /// returns the InsetCode corresponding to the \c name.
71 /// Eg, insetCode("branch") == BRANCH_CODE
72 InsetCode insetCode(std::string const & name);
73 /// returns the Inset name corresponding to the \c InsetCode.
74 /// Eg, insetName(BRANCH_CODE) == "branch"
75 std::string insetName(InsetCode);
76 /// returns the Inset name corresponding to the \c InsetCode.
77 /// Eg, insetDisplayName(BRANCH_CODE) == _("Branch")
78 docstring insetDisplayName(InsetCode);
80 static int const TOC_ENTRY_LENGTH = 120;
82 /// Common base class to all insets
84 // Do not add _any_ (non-static) data members as this would inflate
85 // everything storing large quantities of insets. Mathed e.g. would
92 ENTRY_DIRECTION_IGNORE,
93 ENTRY_DIRECTION_RIGHT,
97 typedef ptrdiff_t difference_type;
98 /// short of anything else reasonable
99 typedef size_t size_type;
100 /// type for cell indices
101 typedef size_t idx_type;
102 /// type for cursor positions
103 typedef ptrdiff_t pos_type;
104 /// type for row numbers
105 typedef size_t row_type;
106 /// type for column numbers
107 typedef size_t col_type;
109 /// virtual base class destructor
112 /// change associated Buffer
113 virtual void setBuffer(Buffer & buffer);
114 /// reset associated Buffer to null value
115 virtual void resetBuffer();
116 /// retrieve associated Buffer
118 Buffer const & buffer() const;
119 /// Returns true if buffer_ actually points to a Buffer that has
120 /// been loaded into LyX and is still open. Note that this will
121 /// always return false for cloned Buffers. If you want to allow
122 /// for the case of cloned Buffers, use isBufferValid().
123 bool isBufferLoaded() const;
124 /// Returns true if this is a loaded buffer or a cloned buffer.
125 bool isBufferValid() const;
127 /// initialize view for this inset.
129 * This is typically used after this inset is created interactively.
130 * Intended purpose is to sanitize internal state with regard to current
133 virtual void initView() {}
134 /// \return true if this inset is labeled.
135 virtual bool isLabeled() const { return false; }
137 /// identification as math inset
138 virtual InsetMath * asInsetMath() { return 0; }
139 /// identification as math inset
140 virtual InsetMath const * asInsetMath() const { return 0; }
141 /// true for 'math' math inset, but not for e.g. mbox
142 virtual bool inMathed() const { return false; }
143 /// is this inset based on the InsetText class?
144 virtual InsetText * asInsetText() { return 0; }
145 /// is this inset based on the InsetText class?
146 virtual InsetText const * asInsetText() const { return 0; }
147 /// is this inset based on the InsetCollapsible class?
148 virtual InsetCollapsible * asInsetCollapsible() { return 0; }
149 /// is this inset based on the InsetCollapsible class?
150 virtual InsetCollapsible const * asInsetCollapsible() const { return 0; }
151 /// is this inset based on the InsetTabular class?
152 virtual InsetTabular * asInsetTabular() { return 0; }
153 /// is this inset based on the InsetTabular class?
154 virtual InsetTabular const * asInsetTabular() const { return 0; }
155 /// is this inset based on the InsetCommand class?
156 virtual InsetCommand * asInsetCommand() { return 0; }
157 /// is this inset based on the InsetCommand class?
158 virtual InsetCommand const * asInsetCommand() const { return 0; }
159 /// is this inset based on the InsetArgument class?
160 virtual InsetArgument const * asInsetArgument() const { return nullptr; }
161 /// is this inset based on the InsetGraphics class?
162 virtual InsetGraphics * asInsetGraphics() { return 0; }
163 /// is this inset based on the InsetGraphics class?
164 virtual InsetGraphics const * asInsetGraphics() const { return 0; }
166 /// the real dispatcher
167 void dispatch(Cursor & cur, FuncRequest & cmd);
169 * \returns true if this function made a definitive decision on
170 * whether the inset wants to handle the request \p cmd or not.
171 * The result of this decision is put into \p status.
173 * Every request that is enabled in this method needs to be handled
174 * in doDispatch(). Normally we have a 1:1 relationship between the
175 * requests handled in getStatus() and doDispatch(), but there are
177 * - A request that is disabled in getStatus() does not need to
178 * appear in doDispatch(). It is guaranteed that doDispatch()
179 * is never called with this request.
180 * - A few requests are en- or disabled in Inset::getStatus().
181 * These need to be handled in the doDispatch() methods of the
182 * derived insets, since Inset::doDispatch() has not enough
183 * information to handle them.
184 * - LFUN_MOUSE_* need not to be handled in getStatus(), because these
185 * are dispatched directly
187 virtual bool getStatus(Cursor & cur, FuncRequest const & cmd,
188 FuncStatus & status) const;
191 virtual void edit(Cursor & cur, bool front,
192 EntryDirection entry_from = ENTRY_DIRECTION_IGNORE);
193 /// sets cursor recursively descending into nested editable insets
195 \return the inset pointer if x,y is covering that inset
196 \param x,y are absolute screen coordinates.
198 /// Note: this method must preserve the selection status. See:
199 /// https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg199001.html
200 virtual Inset * editXY(Cursor & cur, int x, int y);
202 /// The default margin inside text insets
203 static int textOffset(BufferView const *) { return 4; }
205 virtual int topOffset(BufferView const *bv) const { return textOffset(bv); }
207 virtual int bottomOffset(BufferView const *bv) const { return textOffset(bv); }
209 virtual int leftOffset(BufferView const *bv) const { return textOffset(bv); }
211 virtual int rightOffset(BufferView const *bv) const { return textOffset(bv); }
213 /// compute the size of the object returned in dim
214 virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
215 /// draw inset and update (xo, yo)-cache
216 virtual void draw(PainterInfo & pi, int x, int y) const = 0;
217 /// draw inset selection if necessary
218 virtual void drawSelection(PainterInfo &, int, int) const {}
219 /// draw inset background if the inset has an own background and a
220 /// selection is drawn by drawSelection.
221 virtual void drawBackground(PainterInfo &, int, int) const;
223 virtual bool editing(BufferView const * bv) const;
225 virtual bool showInsetDialog(BufferView *) const;
227 /// draw two angular markers
228 virtual void drawMarkers(PainterInfo & pi, int x, int y) const;
229 /// add space for markers
230 void metricsMarkers(Dimension & dim, int framesize = 1) const;
231 /// add space for markers
232 void metricsMarkers2(Dimension & dim, int framesize = 1) const;
233 /// draw inset decoration if necessary.
234 /// This can use \c drawMarkers() for example.
235 virtual void drawDecoration(PainterInfo &, int, int) const {}
237 /// last metrics computed for the inset
238 Dimension const dimension(BufferView const &) const;
239 /// last drawn position for 'important' insets
240 int xo(BufferView const & bv) const;
241 /// last drawn position for 'important' insets
242 int yo(BufferView const & bv) const;
243 /// do we cover screen position x/y?
244 bool covers(BufferView const & bv, int x, int y) const;
245 /// get the screen positions of the cursor (see note in Cursor.cpp)
246 virtual void cursorPos(BufferView const & bv,
247 CursorSlice const & sl, bool boundary, int & x, int & y) const;
249 /// Allow multiple blanks
250 virtual bool isFreeSpacing() const;
251 /// Don't eliminate empty paragraphs
252 virtual bool allowEmpty() const;
253 /// Force inset into LTR environment if surroundings are RTL
254 virtual bool forceLTR(OutputParams const &) const;
255 /// whether to include this inset in the strings generated for the TOC
256 virtual bool isInToc() const;
258 /// Where should we go when we press the up or down cursor key?
259 virtual bool idxUpDown(Cursor & cur, bool up) const;
260 /// Move one cell backwards
261 virtual bool idxBackward(Cursor &) const { return false; }
262 /// Move one cell forward
263 virtual bool idxForward(Cursor &) const { return false; }
265 /// Move to the next cell
266 virtual bool idxNext(Cursor &) const { return false; }
267 /// Move to the previous cell
268 virtual bool idxPrev(Cursor &) const { return false; }
270 /// Target pos when we enter the inset while moving forward
271 virtual bool idxFirst(Cursor &) const { return false; }
272 /// Target pos when we enter the inset while moving backwards
273 virtual bool idxLast(Cursor &) const { return false; }
275 /// Delete a cell and move cursor
276 virtual bool idxDelete(idx_type &) { return false; }
277 /// pulls cell after pressing erase
278 virtual void idxGlue(idx_type) {}
279 /// returns list of cell indices that are "between" from and to for
280 /// selection purposes
281 virtual bool idxBetween(idx_type idx, idx_type from, idx_type to) const;
283 /// to which column belongs a cell with a given index?
284 virtual col_type col(idx_type) const { return 0; }
285 /// to which row belongs a cell with a given index?
286 virtual row_type row(idx_type) const { return 0; }
287 /// cell index corresponding to row and column;
288 virtual idx_type index(row_type row, col_type col) const;
289 /// number of embedded cells
290 virtual size_t nargs() const { return 0; }
291 /// number of rows in gridlike structures
292 virtual size_t nrows() const { return 0; }
293 /// number of columns in gridlike structures
294 virtual size_t ncols() const { return 0; }
295 /// Is called when the cursor leaves this inset.
296 /// Returns true if cursor is now invalid, e.g. if former
297 /// insets in higher cursor slices of \c old do not exist
299 /// \c old is the old cursor, the last slice points to this.
300 /// \c cur is the new cursor. Use the update flags to cause a redraw.
301 virtual bool notifyCursorLeaves(Cursor const & /*old*/, Cursor & /*cur*/)
303 /// Is called when the cursor enters this inset.
304 /// Returns true if cursor is now invalid, e.g. if former
305 /// insets in higher cursor slices of \c old do not exist
307 /// \c cur is the new cursor, some slice points to this. Use the update
308 /// flags to cause a redraw.
309 virtual bool notifyCursorEnters(Cursor & /*cur*/)
311 /// is called when the mouse enters or leaves this inset
312 /// return true if this inset needs a repaint
313 virtual bool setMouseHover(BufferView const *, bool) const
315 /// return true if this inset is hovered (under mouse)
316 /// This is by now only used by mathed to draw corners
317 /// (Inset::drawMarkers() and Inset::drawMarkers2()).
318 /// Other insets do not have to redefine this function to
319 /// return the correct status of mouseHovered.
320 virtual bool mouseHovered(BufferView const *) const { return false; }
322 /// request "external features"
323 virtual void validate(LaTeXFeatures &) const {}
325 /// Validate LFUN_INSET_MODIFY argument.
326 virtual bool validateModifyArgument(docstring const &) const { return true; }
328 /// describe content if cursor inside
329 virtual void infoize(odocstream &) const {}
330 /// describe content if cursor behind
331 virtual void infoize2(odocstream &) const {}
333 enum { PLAINTEXT_NEWLINE = 10000 };
335 /// plain text output in ucs4 encoding
336 /// return the number of characters; in case of multiple lines of
337 /// output, add PLAINTEXT_NEWLINE to the number of chars in the last line
338 virtual int plaintext(odocstringstream &, OutputParams const &,
339 size_t max_length = INT_MAX) const = 0;
341 virtual void docbook(XMLStream &, OutputParams const &) const;
343 /// the inset is expected to write XHTML to the XMLStream
344 /// \return any "deferred" material that should be written outside the
345 /// normal stream, and which will in fact be written after the current
346 /// paragraph closes. this is appropriate e.g. for floats.
347 virtual docstring xhtml(XMLStream &, OutputParams const &) const;
349 /// Writes a string representation of the inset to the odocstream.
350 /// This one should be called when you want the whole contents of
352 virtual void toString(odocstream &) const {}
353 /// Appends a potentially abbreviated version of the inset to
354 /// \param str. Intended for use by the TOC.
355 virtual void forOutliner(docstring & str,
356 size_t const maxlen = TOC_ENTRY_LENGTH,
357 bool const shorten = true) const;
359 /// Can a cursor be put in there ?
360 /// Forced to false for insets that have hidden contents, like
361 /// InsetMathCommand and InsetInfo.
362 virtual bool isActive() const { return nargs() > 0; }
363 /// can the contents of the inset be edited on screen ?
364 // equivalent to isActive except for closed InsetCollapsible
365 virtual bool editable() const;
366 /// has the Inset settings that can be modified in a dialog ?
367 virtual bool hasSettings() const;
368 /// can we go further down on mouse click?
369 /// true for InsetCaption, InsetCollapsibles (not ButtonOnly), InsetTabular
370 virtual bool descendable(BufferView const &) const { return false; }
371 /// can we click at the specified position ?
372 virtual bool clickable(BufferView const &, int, int) const { return false; }
373 /// Move one cell backwards
374 virtual bool allowsCaptionVariation(std::string const &) const { return false; }
375 // true for insets that have a table structure (InsetMathGrid, InsetTabular)
376 virtual bool isTable() const { return false; }
378 /// does this contain text that can be change track marked in DVI?
379 virtual bool canTrackChanges() const { return false; }
380 /// Will this inset paint its own change tracking status (in the parent
381 /// paragraph) or will it let RowPainter handle it?
382 virtual bool canPaintChange(BufferView const &) const { return false; }
383 /// return true if the inset should be removed automatically
384 virtual bool autoDelete() const;
386 /// Returns true if the inset supports completions.
387 virtual bool completionSupported(Cursor const &) const { return false; }
388 /// Returns true if the inset supports inline completions at the
389 /// cursor position. In this case the completion might be stored
390 /// in the BufferView's inlineCompletion property.
391 virtual bool inlineCompletionSupported(Cursor const & /*cur*/) const
393 /// Return true if the inline completion should be automatic.
394 virtual bool automaticInlineCompletion() const { return true; }
395 /// Return true if the popup completion should be automatic.
396 virtual bool automaticPopupCompletion() const { return true; }
397 /// Return true if the cursor should indicate a completion.
398 virtual bool showCompletionCursor() const { return true; }
399 /// Returns completion suggestions at cursor position. Return an
400 /// null pointer if no completion is a available or possible.
401 /// The caller is responsible to free the returned object!
402 virtual CompletionList const * createCompletionList(Cursor const &) const
404 /// Returns the completion prefix to filter the suggestions for completion.
405 /// This is only called if completionList returned a non-null list.
406 virtual docstring completionPrefix(Cursor const &) const;
407 /// Do a completion at the cursor position. Return true on success.
408 /// The completion does not contain the prefix. If finished is true, the
409 /// completion is final. If finished is false, completion might only be
410 /// a partial completion.
411 virtual bool insertCompletion(Cursor & /*cur*/,
412 docstring const & /*completion*/, bool /*finished*/)
414 /// Get the completion inset position and size
415 virtual void completionPosAndDim(Cursor const &, int & /*x*/, int & /*y*/,
416 Dimension & /*dim*/) const {}
418 /// returns true if the inset can hold an inset of given type
419 virtual bool insetAllowed(InsetCode) const { return false; }
420 /// should this inset use the empty layout by default rather than
421 /// the standard layout? (default: only if that is forced.)
422 virtual bool usePlainLayout() const { return forcePlainLayout(); }
423 /// if this inset has paragraphs should they be forced to use the
425 virtual bool forcePlainLayout(idx_type = 0) const { return false; }
426 /// if this inset has paragraphs should the user be allowed to
427 /// customize alignment, etc?
428 virtual bool allowParagraphCustomization(idx_type = 0) const
430 /// Is the width forced to some value?
431 virtual bool hasFixedWidth() const { return false; }
432 /// if this inset has paragraphs should they be forced to use a
433 /// local font language switch?
434 virtual bool forceLocalFontSwitch() const { return false; }
435 /// if this inset has paragraphs should they be forced to use a
436 /// font language switch that switches paragraph directions
437 /// (relevant with polyglossia only)?
438 virtual bool forceParDirectionSwitch() const { return false; }
439 /// Does the inset force a specific encoding?
440 virtual Encoding const * forcedEncoding(Encoding const *, Encoding const *) const
444 /// Is the content of this inset part of the output document?
445 virtual bool producesOutput() const { return true; }
446 /// Is the content of this inset part of the immediate (visible) text sequence?
447 virtual bool isPartOfTextSequence() const { return producesOutput(); }
449 /// \return Tool tip for this inset.
450 /// This default implementation returns an empty string. This can be
451 /// either plain text or Qt html, and formatToolTip will be called
452 /// on it before display in both cases.
453 virtual docstring toolTip(BufferView const & bv, int x, int y) const;
455 /// \return Context menu identifier. This function determines
456 /// whose Inset's menu should be shown for the given position.
457 virtual std::string contextMenu(BufferView const & bv, int x, int y) const;
459 /// \return Context menu identifier for this inset.
460 /// This default implementation returns an empty string.
461 virtual std::string contextMenuName() const;
464 virtual docstring layoutName() const;
466 virtual InsetLayout const & getLayout() const;
468 virtual bool isPassThru() const { return getLayout().isPassThru(); }
469 /// Is this inset embedded in a title?
470 virtual bool isInTitle() const { return false; }
471 /// Is this inset's layout defined in the document's textclass?
472 bool undefined() const;
473 /// should this inset be handled like a normal character?
474 /// (a character can be a letter or punctuation)
475 virtual bool isChar() const { return false; }
476 /// is this equivalent to a letter?
477 /// (a letter is a character that is considered part of a word)
478 virtual bool isLetter() const { return false; }
479 /// is this equivalent to a space (which is BTW different from
480 /// a line separator)?
481 virtual bool isSpace() const { return false; }
482 /// does this inset try to use all available space (like \\hfill does)?
483 virtual bool isHfill() const { return false; }
485 virtual OutputParams::CtObject CtObject(OutputParams const &) const { return OutputParams::CT_NORMAL; }
489 // break row before this inset
490 BreakBefore = 1 << 0,
491 // break row after this inset
493 // it is possible to break after this inset
494 CanBreakAfter = 1 << 2,
495 // force new (maybe empty) row after this inset
497 // specify an alignment (left, right) for a display inset
498 // (default is center)
501 // A display inset breaks row at both ends
502 Display = BreakBefore | BreakAfter
505 /// How should this inset be displayed in its row?
506 virtual RowFlags rowFlags() const { return Inline; }
507 /// indentation before this inset (only needed for displayed hull insets with fleqn option)
508 virtual int indent(BufferView const &) const { return 0; }
510 virtual LyXAlignment contentAlignment() const { return LYX_ALIGN_NONE; }
511 /// should we break lines after this inset?
512 virtual bool isLineSeparator() const { return false; }
513 /// should paragraph indentation be omitted in any case?
514 virtual bool neverIndent() const { return false; }
515 /// dumps content to lyxerr
516 virtual void dump() const;
517 /// write inset in .lyx format
518 virtual void write(std::ostream &) const {}
519 /// read inset in .lyx format
520 virtual void read(Lexer &) {}
521 /** Export the inset to LaTeX.
522 * Don't use a temporary stringstream if the final output is
523 * supposed to go to a file.
524 * \sa Buffer::writeLaTeXSource for the reason.
526 virtual void latex(otexstream &, OutputParams const &) const {}
527 /// returns true to override begin and end inset in file
528 virtual bool directWrite() const;
530 virtual bool allowSpellCheck() const { return false; }
532 /// if this insets owns text cells (e.g. InsetText) return cell num
533 virtual Text * getText(int /*num*/) const { return 0; }
535 /** Adds a LaTeX snippet to the Preview Loader for transformation
536 * into a bitmap image. Does not start the loading process.
538 * Most insets have no interest in this capability, so the method
541 virtual void addPreview(DocIterator const &,
542 graphics::PreviewLoader &) const {}
544 /** Classifies the unicode characters appearing in a math inset
545 * depending on whether they are to be translated as latex
546 * math/text commands or used as math symbols without translation.
548 * Only math insets have interest in this classification, so the
549 * method defaults to empty.
551 virtual void initUnicodeMath() const {}
553 /// Add an entry to the TocList
554 /// Pass a DocIterator that points at the paragraph containing
557 /// \param output_active : is the inset active or is it in an inactive
558 /// branch or a note?
560 /// \param utype : is the toc being generated for use by the output
563 /// \param tocbackend : where to add the toc information.
564 virtual void addToToc(DocIterator const & /* di */,
565 bool /* output_active */,
566 UpdateType /* utype*/,
567 TocBackend & /* tocbackend */) const {}
568 /// Collect BibTeX information
569 virtual void collectBibKeys(InsetIterator const &, support::FileNameList &) const {}
570 /// Update the counters of this inset and of its contents.
571 /// The boolean indicates whether we are preparing for output, e.g.,
573 virtual void updateBuffer(ParIterator const &, UpdateType, bool const) {}
575 /// Updates the inset's dialog
576 virtual Buffer const * updateFrontend() const;
579 /// returns LyX code associated with the inset. Used for TOC, ...)
580 virtual InsetCode lyxCode() const { return NO_CODE; }
583 enum mode_type {UNDECIDED_MODE, TEXT_MODE, MATH_MODE};
584 /// return text or mathmode if that is possible to determine
585 virtual mode_type currentMode() const { return UNDECIDED_MODE; }
586 /// returns whether changing mode during latex export is forbidden
587 virtual bool lockedMode() const { return false; }
588 /// returns whether only ascii chars are allowed during latex export
589 virtual bool asciiOnly() const { return false; }
590 /// returns whether this inset is allowed in other insets of given mode
591 virtual bool allowedIn(mode_type) const { return true; }
592 /// returns whether paragraph breaks can occur inside this inset
593 virtual bool allowMultiPar() const { return false; }
595 * The font is inherited from the parent for LaTeX export if this
596 * method returns true. No open font changes are closed in front of
597 * the inset for LaTeX export, and the font is inherited for all other
598 * exports as well as on screen.
599 * If this method returns false all open font changes are closed in
600 * front of the inset for LaTeX export. The default font is used
601 * inside the inset for all exports and on screen.
603 virtual bool inheritFont() const { return true; }
605 * If this method returns true all explicitly set font attributes
606 * are reset during editing operations.
607 * For copy/paste operations the language is never changed, since
608 * the language of a given text never changes if the text is
609 * formatted differently, while other font attributes like size may
610 * need to change if the text is copied from one environment to
612 * If this method returns false no font attribute is reset.
613 * The default implementation returns true if the resetFont layout
614 * tag is set and otherwise the negation of inheritFont(),
615 * since inherited inset font attributes do not need to be changed,
616 * and non-inherited ones need to be set explicitly.
618 virtual bool resetFontEdit() const;
620 /// does the inset contain changes ?
621 virtual bool isChanged() const { return false; }
622 /// set the change for the entire inset
623 virtual void setChange(Change const &) {}
624 /// accept the changes within the inset
625 virtual void acceptChanges() {}
626 /// reject the changes within the inset
627 virtual void rejectChanges() {}
630 virtual bool needsCProtection(bool const, bool const) const { return false; }
633 virtual ColorCode backgroundColor(PainterInfo const &) const;
635 virtual ColorCode labelColor() const;
637 /// Determine the action of backspace and delete: do we select instead of
638 /// deleting if not already selected?
639 virtual bool confirmDeletion() const { return false; }
643 Inset(Buffer * buf) : buffer_(buf) {}
644 Inset(Inset const &) : buffer_(0) {}
646 /// replicate ourselves
647 friend class InsetList;
648 friend class MathAtom;
649 virtual Inset * clone() const = 0;
651 /** The real dispatcher.
652 * Gets normally called from Cursor::dispatch(). Cursor::dispatch()
653 * assumes the common case of 'LFUN handled, need update'.
654 * This has to be overridden by calling Cursor::undispatched() or
655 * Cursor::noScreenUpdate() if appropriate.
656 * If you need to call the dispatch method of some inset directly
657 * you may have to explicitly request an update at that place. Don't
658 * do it in doDispatch(), since that causes nested updates when
659 * called from Cursor::dispatch(), and these can lead to crashes.
662 virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
668 inline Inset::RowFlags operator|(Inset::RowFlags const d1,
669 Inset::RowFlags const d2)
671 return static_cast<Inset::RowFlags>(int(d1) | int(d2));
675 inline Inset::RowFlags operator&(Inset::RowFlags const d1,
676 Inset::RowFlags const d2)
678 return static_cast<Inset::RowFlags>(int(d1) & int(d2));