As an added bonus, the selection will be adapted to current Buffer (for quites, etc).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26001
a592a061-630c-0410-9148-
cb99ea01b6c8
}
-vector<docstring> availableSelections()
+vector<docstring> availableSelections(Buffer const * buf)
{
vector<docstring> selList;
+ if (!buf)
+ return selList;
CutStack::const_iterator cit = theCuts.begin();
CutStack::const_iterator end = theCuts.end();
ParagraphList::const_iterator pit = pars.begin();
ParagraphList::const_iterator pend = pars.end();
for (; pit != pend; ++pit) {
- asciiSel += pit->asString(AS_STR_INSETS);
+ Paragraph par(*pit, 0, 26);
+ // adapt paragraph to current buffer.
+ par.setBuffer(const_cast<Buffer &>(*buf));
+ asciiSel += par.asString(AS_STR_INSETS);
if (asciiSel.size() > 25) {
asciiSel.replace(22, docstring::npos,
from_ascii("..."));
namespace cap {
/// Get all elements of the cut buffer in plain text format.
-std::vector<docstring> availableSelections();
+std::vector<docstring> availableSelections(Buffer const *);
/// Get the number of available elements in the cut buffer.
size_type numberOfSelections();
/// Get the sel_index-th element of the cut buffer in plain text format.
void expandFlexInsert(Buffer const * buf, std::string s);
void expandToc2(Toc const & toc_list, size_t from, size_t to, int depth);
void expandToc(Buffer const * buf);
- void expandPasteRecent();
+ void expandPasteRecent(Buffer const * buf);
void expandToolbars();
void expandBranches(Buffer const * buf);
void expandCiteStyles(BufferView const *);
}
-void MenuDefinition::expandPasteRecent()
+void MenuDefinition::expandPasteRecent(Buffer const * buf)
{
- docstring_list const sel = cap::availableSelections();
+ docstring_list const sel = cap::availableSelections(buf);
docstring_list::const_iterator cit = sel.begin();
docstring_list::const_iterator end = sel.end();
break;
case MenuItem::PasteRecent:
- tomenu.expandPasteRecent();
+ tomenu.expandPasteRecent(buf);
break;
case MenuItem::Toolbars: